-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial my-area layout update #617
Changes from all commits
d1c2cef
22bcacd
44ce982
38bc0af
1bfcf62
33bf242
e00e320
f3e0d2e
0f3f867
bbb30fc
dc0b5e0
cdccd92
7c6b8ef
05dc63e
d0d97c7
67db15a
276c694
aa16fb1
a3e0db0
e66c147
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<link rel="import" href="../../bower_components/polymer/polymer-element.html"> | ||
<link rel="import" href="../../bower_components/iron-icon/iron-icon.html"> | ||
|
||
<dom-module id="lancie-info-box"> | ||
<template> | ||
<style> | ||
:host { | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
margin: 8px; | ||
padding: 20px; | ||
background: var(--base-bg-color); | ||
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, .26); | ||
--icon-fill-color: var(--paper-grey-700); | ||
flex: 1; | ||
} | ||
|
||
:host ::slotted(*) { | ||
color: var(--my-area-grey); | ||
} | ||
|
||
iron-icon { | ||
display: block; | ||
margin-right: 16px; | ||
height: 60px; | ||
width: 60px; | ||
--iron-icon-fill-color: var(--icon-fill-color); | ||
} | ||
|
||
.info, | ||
.heading { | ||
display: block; | ||
position: relative; | ||
color: var(--my-area-grey); | ||
text-align: right; | ||
} | ||
|
||
.heading { | ||
font-size: 1.2em; | ||
font-weight: 300; | ||
text-transform: uppercase; | ||
} | ||
|
||
.info { | ||
font-size: 1.8em; | ||
font-weight: 500; | ||
margin-top: 5px; | ||
} | ||
|
||
</style> | ||
|
||
<div> | ||
<iron-icon icon="{{icon}}"></iron-icon> | ||
<slot></slot> | ||
</div> | ||
<div> | ||
<span class="heading">{{heading}}</span> | ||
<span class="info">{{info}}</span> | ||
</div> | ||
|
||
</template> | ||
<script> | ||
class LancieInfoBox extends Polymer.Element { | ||
static get is() { | ||
return 'lancie-info-box'; | ||
} | ||
|
||
static get properties() { | ||
return { | ||
icon: String, | ||
heading: String, | ||
info: String, | ||
}; | ||
} | ||
} | ||
|
||
customElements.define(LancieInfoBox.is, LancieInfoBox); | ||
</script> | ||
</dom-module> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,166 @@ | ||
<link rel="import" href="../../bower_components/polymer/polymer.html"> | ||
<link rel="import" href="../../bower_components/iron-flex-layout/iron-flex-layout-classes.html"> | ||
<link rel="import" href="../../bower_components/polymer/polymer-element.html"> | ||
<link rel="import" href="my-area-profile.html"> | ||
<link rel="import" href="my-area-teams.html"> | ||
<link rel="import" href="my-area-orders.html"> | ||
<link rel="import" href="my-area-seat.html"> | ||
<link rel="import" href="my-area-discord.html"> | ||
<link rel="import" href="../lancie-section/lancie-section.html"> | ||
<link rel="import" href="lancie-info-box.html"> | ||
<link rel="import" href="../lancie-icons.html"> | ||
|
||
<dom-module id="lancie-my-area"> | ||
<template> | ||
<style include="iron-flex iron-flex-alignment iron-flex-factors"></style> | ||
<style> | ||
:host { | ||
display: block; | ||
--card-min-width: 300px; | ||
--my-area-grey: #515D6E; | ||
} | ||
|
||
.card { | ||
margin: 8px; | ||
min-width: var(--card-min-width); | ||
h1 { | ||
font-size: 2.4em; | ||
font-weight: 300; | ||
line-height: 48px; | ||
margin: 0 0 16px 8px; | ||
} | ||
|
||
.container { | ||
padding: 32px; | ||
} | ||
|
||
.cards-container { | ||
display: flex; | ||
flex-direction: row; | ||
flex-wrap: wrap; | ||
justify-content: flex-start; | ||
} | ||
|
||
/* | ||
* Safari hack | ||
* Makes flex wrapping work | ||
*/ | ||
.flex, .flex-1, .flex-2, .flex-3 { | ||
.cards-container > div { | ||
display: flex; | ||
flex-direction: column; | ||
flex-wrap: wrap; | ||
flex-grow: 1; | ||
margin: 0 8px; | ||
min-width: var(--card-min-width); | ||
flex-basis: var(--card-min-width); | ||
} | ||
/*End Safari hack*/ | ||
|
||
.cards-container > div > *{ | ||
margin: 8px 0; | ||
} | ||
|
||
.info-boxes { | ||
display: flex; | ||
flex-direction: row; | ||
flex-wrap: wrap; | ||
} | ||
|
||
lancie-info-box { | ||
min-width: var(--card-min-width); | ||
} | ||
|
||
.seat { | ||
--icon-fill-color: var(--paper-red-500); | ||
} | ||
|
||
.ticket { | ||
--icon-fill-color: var(--paper-green-500); | ||
} | ||
|
||
.team { | ||
--icon-fill-color: var(--paper-blue-500); | ||
} | ||
|
||
.discord { | ||
--icon-fill-color: var(--paper-grey-800); | ||
} | ||
|
||
.discord:hover { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm having some difficulty seeing that this is actually clickable. Isn't it a good idea to make it a link or something? Maybe add a slot and put a button in there? I think that the current representation doesn't communicate that it is going somewhere. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True, I experimented with a label showing on hover, but that was pretty ugly :P. Will take a second look at it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A "Join" button or something should make it pretty clear. I guess a |
||
cursor: pointer; | ||
-webkit-transform: translateY(-2px); | ||
transform: translateY(-2px); | ||
box-shadow: 0 7px 14px rgba(50, 50, 93, .1), 0 3px 6px rgba(0, 0, 0, .08) | ||
} | ||
|
||
@media (max-width: 600px) { | ||
lancie-info-box { | ||
min-width: 200px; | ||
} | ||
.container { | ||
margin: 8px; | ||
padding: 0; | ||
} | ||
} | ||
</style> | ||
<lancie-section type="primary full" header="My Area - {{user.profile.displayName}}"> | ||
<div> | ||
<div class="layout horizontal start wrap"> | ||
<my-area-profile user="{{user}}" class="flex-2 card"></my-area-profile> | ||
<my-area-teams user="{{user}}" class="flex-2 card"></my-area-teams> | ||
<my-area-discord class="flex-1 card"></my-area-discord> | ||
|
||
<lancie-ajax | ||
auto-fire | ||
skip-token | ||
absoluteurl="https://discordapp.com/api/servers/146690066541051904/widget.json" | ||
last-response="{{discordWidget}}"> | ||
</lancie-ajax> | ||
|
||
<div class="container"> | ||
<h1>My Area - [[user.profile.displayName]]</h1> | ||
<div class="info-boxes"> | ||
<lancie-info-box class="seat" heading="Seat" icon="lancie:event-seat" | ||
info$="{{_computeSeatInfo(seats)}}"></lancie-info-box> | ||
<lancie-info-box class="ticket" heading="Ticket" icon="lancie:local-activity" | ||
info$="{{_computeTicketInfo(tickets)}}"></lancie-info-box> | ||
<lancie-info-box class="team" heading="Team" icon="lancie:group" | ||
info$="{{_computeTeamInfo(teams)}}"></lancie-info-box> | ||
<lancie-info-box on-tap="openDiscordLink" class="discord" heading="Discord" icon="lancie:discord" | ||
info$="{{discordWidget.members.length}} Online "><span>Tap to join!</span></lancie-info-box> | ||
</div> | ||
<div class="cards-container"> | ||
<div> | ||
<my-area-profile user="{{user}}"></my-area-profile> | ||
<my-area-seat user="[[user]]" seats="{{seats}}"></my-area-seat> | ||
</div> | ||
<div class="layout horizontal start wrap"> | ||
<my-area-orders user="[[user]]" class="flex-3 card"></my-area-orders> | ||
<my-area-seat class="flex-2 card"></my-area-seat> | ||
<div> | ||
<my-area-teams user="[[user]]" teams="{{teams}}"></my-area-teams> | ||
<my-area-orders user="[[user]]" tickets="{{tickets}}"></my-area-orders> | ||
</div> | ||
</div> | ||
</lancie-section> | ||
</div> | ||
</template> | ||
<script> | ||
Polymer({ | ||
is: 'lancie-my-area', | ||
properties: { | ||
user: { | ||
type: Object | ||
class LancieMyArea extends Polymer.Element { | ||
static get is() { | ||
return 'lancie-my-area'; | ||
} | ||
|
||
static get properties() { | ||
return { | ||
user: Object, | ||
tickets: Array, | ||
teams: Array, | ||
seats: Array, | ||
}; | ||
} | ||
|
||
_computeSeatInfo(seats) { | ||
for (let seat of seats) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can replace this for loop with an if case with a filter call, one line and easier to read. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What if there are multiple tickets owned by the user? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just take the first one, just like with the teams I think 🤔 . All seats are listed in the seats card, too. |
||
if (seat.ticket.owner.reference === this.user.reference) { | ||
return `${seat.seatGroup}${seat.seatNumber}`; | ||
} | ||
} | ||
return 'None'; | ||
} | ||
|
||
_computeTicketInfo(tickets) { | ||
return tickets.length ? (tickets[0].valid ? 'Purchased' : 'Unknown') : 'None'; | ||
} | ||
|
||
_computeTeamInfo(teams) { | ||
return teams.length ? teams[0].teamName : 'None'; | ||
} | ||
|
||
openDiscordLink(){ | ||
/*jshint camelcase: false */ | ||
window.open(this.discordWidget.instant_invite, '_blank'); | ||
/*jshint camelcase: true */ | ||
} | ||
} | ||
}); | ||
|
||
customElements.define(LancieMyArea.is, LancieMyArea); | ||
</script> | ||
</dom-module> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the benefit of using
em
as a measure of size?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its the same as saying: current font size x1.2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be wise to do this to all font font sizes where it would be logical? Not in this PR, but from now on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say that it slightly improves readability in case of font sizes (vs. using px)