diff --git a/app/assets/images/junto.gif b/app/assets/images/junto.gif new file mode 100644 index 00000000..e4a72d4b Binary files /dev/null and b/app/assets/images/junto.gif differ diff --git a/app/assets/stylesheets/mapcard.scss.erb b/app/assets/stylesheets/mapcard.scss.erb index 871b6baf..69e3b71d 100644 --- a/app/assets/stylesheets/mapcard.scss.erb +++ b/app/assets/stylesheets/mapcard.scss.erb @@ -1,144 +1,163 @@ /* Map Cards */ .map { - display:inline-block; - width:220px; - height:340px; - font-size: 12px; - text-align: left; - overflow: visible; - background: #e8e8e8; - border-radius:2px; - margin:16px; - box-shadow: 0px 3px 3px rgba(0,0,0,0.23), 0 3px 3px rgba(0,0,0,0.16); -} -.map.newMap { - float: left; - position: relative; -} -.map.newMap:hover { - background: #dcdcdc; -} -.map.newMap a { - height: 340px; - display: block; - position: relative; -} -.newMap .newMapImage { - display: block; - width: 72px; - height: 72px; - background-image: url("<%= asset_data_uri('newmap_sprite.png') %>"); - background-repeat: no-repeat; - background-position: 0 0; - position: absolute; - left: 50%; - margin-left: -36px; - top: 50%; - margin-top: -36px; -} -.map:hover .newMapImage { - background-position: 0 -72px; -} -.newMap span { - font-family: 'din-regular', sans-serif; - font-size: 18px; - line-height: 22px; - text-align: center; - display: block; - padding-top: 220px; -} + display:inline-block; + width:220px; + height:340px; + font-size: 12px; + text-align: left; + overflow: visible; + background: #e8e8e8; + border-radius:2px; + margin:16px; + box-shadow: 0px 3px 3px rgba(0,0,0,0.23), 0 3px 3px rgba(0,0,0,0.16); -.mapCard { - position:relative; - width:100%; - height:308px; - padding: 0 0 16px 0; - color: #424242; + &.newMap { + float: left; + position: relative; -.mapScreenshot { - width: 100%; - height: 220px; -} + &:hover { + background: #dcdcdc; -.mapScreenshot img { - width: 100%; -} + .newMapImage { + background-position: 0 -72px; + } + } -.title { - word-wrap: break-word; - font-size:18px; - line-height:22px; - height: 71px; - display:table; - padding: 0 16px; - font-family: 'din-regular', sans-serif; - margin: 0 auto; + a { + height: 340px; + display: block; + position: relative; + } + + .newMapImage { + display: block; + width: 72px; + height: 72px; + background-image: url("<%= asset_data_uri('newmap_sprite.png') %>"); + background-repeat: no-repeat; + background-position: 0 0; + position: absolute; + left: 50%; + margin-left: -36px; + top: 50%; + margin-top: -36px; + } + + span { + font-family: 'din-regular', sans-serif; + font-size: 18px; + line-height: 22px; + text-align: center; + display: block; + padding-top: 220px; + } + } + + .mapCard { + position:relative; + width:100%; + height:308px; + padding: 0 0 16px 0; + color: #424242; + + .mapHasMapper, .mapHasConversation { + position: absolute; + top: 5px; + left: 5px; + width: 32px; + height: 32px; + } + .mapHasMapper { + background: url('<%= asset_path('junto.png') %>'); + } + .mapHasConversation { + background: url('<%= asset_path('junto.gif') %>'); + } + + .mapScreenshot { + width: 100%; + height: 220px; + } + + .mapScreenshot img { + width: 100%; + } + + .title { + word-wrap: break-word; + font-size:18px; + line-height:22px; + height: 71px; + display:table; + padding: 0 16px; + font-family: 'din-regular', sans-serif; + margin: 0 auto; + + .innerTitle { + display: table-cell; + vertical-align: middle; + text-align: center; + } + } + + .creatorAndPerm { + padding: 8px; + } + + .creatorImage { + display: inline-block; + border-radius: 16px; + vertical-align: middle; + width: 32px; + height: 32px; + } + + span.creatorName { + margin-left: 8px; + } + + + .scroll { + display:block; + font-family: helvetica, sans-serif; + font-size: 12px; + word-wrap: break-word; + text-align: center; + margin-top: 16px; + } + + &:hover .mainContent { + filter: blur(2px); + } + + &:hover .mapMetadata { + display: block; + } + + .mapMetadata { + display: none; + position: absolute; + top: 0; + left: 0; + padding: 40px 20px 0; + height: 300px; + font-family: 'din-regular', sans-serif; + font-size: 12px; + color: #FFF; + background: -moz-linear-gradient(top, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0.43) 81%, rgba(0,0,0,0) 100%); + background: -webkit-linear-gradient(top, rgba(0,0,0,0.65) 0%,rgba(0,0,0,0.43) 81%,rgba(0,0,0,0) 100%); + background: linear-gradient(to bottom, rgba(0,0,0,0.65) 0%,rgba(0,0,0,0.43) 81%,rgba(0,0,0,0) 100%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a6000000', endColorstr='#00000000',GradientType=0 ); + } + + .metadataSection { + padding: 16px 0; + width: 90px; + float: left; + font-family: 'din-medium', sans-serif; + text-align: center; + } - .innerTitle { - display: table-cell; - vertical-align: middle; - text-align: center; } } - -.creatorAndPerm { - padding: 8px; -} - -.creatorImage { - display: inline-block; - border-radius: 16px; - vertical-align: middle; - width: 32px; - height: 32px; -} - -span.creatorName { - margin-left: 8px; -} - - -.scroll { - display:block; - font-family: helvetica, sans-serif; - font-size: 12px; - word-wrap: break-word; - text-align: center; - margin-top: 16px; -} - -&:hover .mainContent { - filter: blur(2px); -} - -&:hover .mapMetadata { - display: block; -} - -.mapMetadata { - display: none; - position: absolute; - top: 0; - left: 0; - padding: 40px 20px 0; - height: 300px; - font-family: 'din-regular', sans-serif; - font-size: 12px; - color: #FFF; - background: -moz-linear-gradient(top, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0.43) 81%, rgba(0,0,0,0) 100%); - background: -webkit-linear-gradient(top, rgba(0,0,0,0.65) 0%,rgba(0,0,0,0.43) 81%,rgba(0,0,0,0) 100%); - background: linear-gradient(to bottom, rgba(0,0,0,0.65) 0%,rgba(0,0,0,0.43) 81%,rgba(0,0,0,0) 100%); - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a6000000', endColorstr='#00000000',GradientType=0 ); -} - -.metadataSection { - padding: 16px 0; - width: 90px; - float: left; - font-family: 'din-medium', sans-serif; - text-align: center; -} - -} - diff --git a/frontend/src/Metamaps/Views/index.js b/frontend/src/Metamaps/Views/index.js index 329263b3..0372efa4 100644 --- a/frontend/src/Metamaps/Views/index.js +++ b/frontend/src/Metamaps/Views/index.js @@ -6,7 +6,7 @@ import { JUNTO_UPDATED } from '../Realtime/events' const Views = { init: () => { - $(document).on(JUNTO_UPDATED, ExploreMaps.render()) + $(document).on(JUNTO_UPDATED, () => ExploreMaps.render()) }, ExploreMaps, ChatView, diff --git a/frontend/src/components/Maps/MapCard.js b/frontend/src/components/Maps/MapCard.js index 3a1557ee..1cb99530 100644 --- a/frontend/src/components/Maps/MapCard.js +++ b/frontend/src/components/Maps/MapCard.js @@ -1,8 +1,19 @@ import React, { Component, PropTypes } from 'react' +import { find, values } from 'lodash' + +const IN_CONVERSATION = 1 // shared with /realtime/reducer.js + +const MapperList = (props) => { + +} class MapCard extends Component { render = () => { - const { map, currentUser } = this.props + const { map, juntoState, currentUser } = this.props + + const hasMap = juntoState.liveMaps[map.id] + const hasConversation = hasMap && find(values(hasMap), v => v === IN_CONVERSATION) + const hasMapper = hasMap && !hasConversation function capitalize (string) { return string.charAt(0).toUpperCase() + string.slice(1) @@ -59,6 +70,8 @@ class MapCard extends Component { + { hasMapper &&
} + { hasConversation && } @@ -69,6 +82,7 @@ class MapCard extends Component { MapCard.propTypes = { map: PropTypes.object.isRequired, + juntoState: PropTypes.object, currentUser: PropTypes.object } diff --git a/frontend/src/components/Maps/index.js b/frontend/src/components/Maps/index.js index 3b81eea7..a714e4ca 100644 --- a/frontend/src/components/Maps/index.js +++ b/frontend/src/components/Maps/index.js @@ -33,7 +33,7 @@ class Maps extends Component { } resize = () => { - const { maps, juntoState, user, currentUser } = this.props + const { maps, user, currentUser } = this.props const numCards = maps.length + (user || currentUser ? 1 : 0) const mapSpaces = Math.floor(document.body.clientWidth / MAP_WIDTH) const mapsWidth = Math.min(MAX_COLUMNS, Math.min(numCards, mapSpaces)) * MAP_WIDTH @@ -41,7 +41,7 @@ class Maps extends Component { } render = () => { - const { maps, currentUser, section, user, moreToLoad, loadMore } = this.props + const { maps, currentUser, juntoState, section, user, moreToLoad, loadMore } = this.props const style = { width: this.state.mapsWidth + 'px' } return ( @@ -50,7 +50,7 @@ class Maps extends Component {