Skip to content
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

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
margin: 0;
--primary-color: #1a2b43;
--secondary-color: #ffe574;
--base-bg-color: #fafafa;
}

app-toolbar {
Expand Down Expand Up @@ -141,7 +142,7 @@
display: block;
}

#reload-toast {
#reload-toast, #msg-toast {
--paper-toast-color: white;
}

Expand Down Expand Up @@ -193,7 +194,7 @@

<!-- Nav on mobile: side nav menu -->
<app-toolbar>
<paper-icon-button class="menu-button" icon="menu" drawer-toggle aria-label="Drawer navigation menu"></paper-icon-button>
<paper-icon-button class="menu-button" icon="lancie:menu" drawer-toggle aria-label="Drawer navigation menu"></paper-icon-button>

<a href="/" aria-label="Homepage">
<img
Expand Down
1 change: 0 additions & 1 deletion src/index-imports.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<link rel="import" href="../bower_components/app-layout/app-drawer/app-drawer.html">
<link rel="import" href="../bower_components/paper-listbox/paper-listbox.html">
<!-- TODO: Generate custom icon set -->
<link rel="import" href="../bower_components/iron-icons/iron-icons.html">
<link rel="import" href="../bower_components/paper-icon-button/paper-icon-button.html">

<link rel="import" href="../bower_components/wisvch-footer/wisvch-footer.html">
Expand Down
4 changes: 3 additions & 1 deletion src/lancie-activity/lancie-activity-dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
<link rel="import" href="lancie-activity-sponsor.html">
<link rel="import" href="../../bower_components/lancie-dialog/lancie-dialog.html">

<link rel="import" href="../lancie-icons.html">

<dom-module id="lancie-activity-dialog">
<template>
<style>
Expand Down Expand Up @@ -87,7 +89,7 @@
<lancie-dialog id="lancieDialog">
<div class="dialog-header">
<h2><strong>[[data.sponsor.name]]</strong> <span>[[data.headerTitle]]</span></h2>
<paper-icon-button icon="close" dialog-dismiss></paper-icon-button>
<paper-icon-button icon="lancie:clear" dialog-dismiss></paper-icon-button>
</div>
<div class="dialog-content">
<lancie-activity-content data="[[data]]"></lancie-activity-content>
Expand Down
14 changes: 7 additions & 7 deletions src/lancie-home-page/lancie-subscribe-mail-form.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<link rel="import" href="../../bower_components/polymer/polymer-element.html">

<link rel="import" href="../../bower_components/lancie-error/lancie-error.html">
<link rel="import" href="../../bower_components/lancie-form/lancie-form.html">
<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
<link rel="import" href="../../bower_components/iron-icon/iron-icon.html">
<link rel="import" href="../../bower_components/paper-button/paper-button.html">
<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="../../bower_components/paper-input/paper-input.html">
<link rel="import" href="../../bower_components/iron-icon/iron-icon.html">
<link rel="import" href="../../bower_components/lancie-error/lancie-error.html">
<link rel="import" href="../../bower_components/lancie-form/lancie-form.html">

<link rel="import" href="../lancie-icons.html">

<dom-module id="lancie-subscribe-mail-form">
<template>
Expand All @@ -23,8 +23,8 @@
<lancie-form id="mailForm" refurl="subscriptions" method="POST" class="mail-input" on-response="onResponse">
<lancie-error id="alert"></lancie-error>
<paper-input label="E-Mail" name="email" class="mail-input" value="{{email}}" on-keydown="onEnter">
<iron-icon icon="mail" slot="prefix"></iron-icon>
<paper-icon-button slot="suffix" on-tap="clearInput" icon="clear" alt="clear" title="Clear"></paper-icon-button>
<iron-icon icon="lancie:mail" slot="prefix"></iron-icon>
<paper-icon-button slot="suffix" on-tap="clearInput" icon="lancie:clear" alt="clear" title="Clear"></paper-icon-button>
</paper-input>
<paper-button disabled="[[!email]]" on-tap="trySubmit">Sign up</paper-button>
</lancie-form>
Expand Down
32 changes: 31 additions & 1 deletion src/lancie-icons.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,37 @@

<iron-iconset-svg size="24" name="lancie">
<svg><defs>
<g id="cached"><path d="M19 8l-4 4h3c0 3.31-2.69 6-6 6-1.01 0-1.97-.25-2.8-.7l-1.46 1.46C8.97 19.54 10.43 20 12 20c4.42 0 8-3.58 8-8h3l-4-4zM6 12c0-3.31 2.69-6 6-6 1.01 0 1.97.25 2.8.7l1.46-1.46C15.03 4.46 13.57 4 12 4c-4.42 0-8 3.58-8 8H1l4 4 4-4H6z"></path></g>
<g id="account-circle"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 14.2c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22z"/></g>
<g id="add-shopping-cart"><path d="M11 9h2V6h3V4h-3V1h-2v3H8v2h3v3zm-4 9c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zm10 0c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2zm-9.83-3.25l.03-.12.9-1.63h7.45c.75 0 1.41-.41 1.75-1.03l3.86-7.01L19.42 4h-.01l-1.1 2-2.76 5H8.53l-.13-.27L6.16 6l-.95-2-.94-2H1v2h2l3.6 7.59-1.35 2.45c-.16.28-.25.61-.25.96 0 1.1.9 2 2 2h12v-2H7.42c-.13 0-.25-.11-.25-.25z"/></g>
<g id="arrow-downward"><path d="M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"></path></g>
<g id="cached"><path d="M19 8l-4 4h3c0 3.31-2.69 6-6 6-1.01 0-1.97-.25-2.8-.7l-1.46 1.46C8.97 19.54 10.43 20 12 20c4.42 0 8-3.58 8-8h3l-4-4zM6 12c0-3.31 2.69-6 6-6 1.01 0 1.97.25 2.8.7l1.46-1.46C15.03 4.46 13.57 4 12 4c-4.42 0-8 3.58-8 8H1l4 4 4-4H6z"></path></g>
<g id="cake"><path d="M12 6c1.11 0 2-.9 2-2 0-.38-.1-.73-.29-1.03L12 0l-1.71 2.97c-.19.3-.29.65-.29 1.03 0 1.1.9 2 2 2zm4.6 9.99l-1.07-1.07-1.08 1.07c-1.3 1.3-3.58 1.31-4.89 0l-1.07-1.07-1.09 1.07C6.75 16.64 5.88 17 4.96 17c-.73 0-1.4-.23-1.96-.61V21c0 .55.45 1 1 1h16c.55 0 1-.45 1-1v-4.61c-.56.38-1.23.61-1.96.61-.92 0-1.79-.36-2.44-1.01zM18 9h-5V7h-2v2H6c-1.66 0-3 1.34-3 3v1.54c0 1.08.88 1.96 1.96 1.96.52 0 1.02-.2 1.38-.57l2.14-2.13 2.13 2.13c.74.74 2.03.74 2.77 0l2.14-2.13 2.13 2.13c.37.37.86.57 1.38.57 1.08 0 1.96-.88 1.96-1.96V12C21 10.34 19.66 9 18 9z"/></g>
<g id="check" fill="#4CAF50"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/></g>
<g id="clear" fill="#F44336"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></g>
<g id="create"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"/></g>
<g id="delete"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/></g>
<g id="description"><path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"/></g>
<g id="email"><path d="M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"/></g>
<g id="event-seat"><path d="M4 18v3h3v-3h10v3h3v-6H4zm15-8h3v3h-3zM2 10h3v3H2zm15 3H7V5c0-1.1.9-2 2-2h6c1.1 0 2 .9 2 2v8z"/></g>
<g id="group"><path d="M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5c-1.66 0-3 1.34-3 3s1.34 3 3 3zm-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5C6.34 5 5 6.34 5 8s1.34 3 3 3zm0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5zm8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5z"/></g>
<g id="group-add"><path d="M8 10H5V7H3v3H0v2h3v3h2v-3h3v-2zm10 1c1.66 0 2.99-1.34 2.99-3S19.66 5 18 5c-.32 0-.63.05-.91.14.57.81.9 1.79.9 2.86s-.34 2.04-.9 2.86c.28.09.59.14.91.14zm-5 0c1.66 0 2.99-1.34 2.99-3S14.66 5 13 5c-1.66 0-3 1.34-3 3s1.34 3 3 3zm6.62 2.16c.83.73 1.38 1.66 1.38 2.84v2h3v-2c0-1.54-2.37-2.49-4.38-2.84zM13 13c-2 0-6 1-6 3v2h12v-2c0-2-4-3-6-3z"/></g>
<g id="inbox"><path d="M19 3H4.99c-1.11 0-1.98.89-1.98 2L3 19c0 1.1.88 2 1.99 2H19c1.1 0 2-.9 2-2V5c0-1.11-.9-2-2-2zm0 12h-4c0 1.66-1.35 3-3 3s-3-1.34-3-3H4.99V5H19v10z"/></g>
<g id="info"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/></g>
<g id="local-activity"><path d="M20 12c0-1.1.9-2 2-2V6c0-1.1-.9-2-2-2H4c-1.1 0-1.99.9-1.99 2v4c1.1 0 1.99.9 1.99 2s-.89 2-2 2v4c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2v-4c-1.1 0-2-.9-2-2zm-4.42 4.8L12 14.5l-3.58 2.3 1.08-4.12-3.29-2.69 4.24-.25L12 5.8l1.54 3.95 4.24.25-3.29 2.69 1.09 4.11z"/></g>
<g id="location-on"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"/></g>
<g id="lock"><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/></g>
<g id="mail"><path d="M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"/></g>
<g id="markunread-mailbox"><path d="M20 6H10v6H8V4h6V0H6v6H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2z"/></g>
<g id="menu"><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/></g>
<g id="person"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></g>
<g id="person-add"><path d="M15 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm-9-2V7H4v3H1v2h3v3h2v-3h3v-2H6zm9 4c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></g>
<g id="phone"><path d="M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z"/></g>
<g id="refresh"><path d="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"/></g>
<g id="remove"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></g>
<g id="send"><path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/></g>
<g id="discord" viewBox="0 0 250 250">
<path d="M104.4 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1.1-6.1-4.5-11.1-10.2-11.1zM140.9 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1s-4.5-11.1-10.2-11.1z"/>
<path d="M189.5 20h-134C44.2 20 35 29.2 35 40.6v135.2c0 11.4 9.2 20.6 20.5 20.6h113.4l-5.3-18.5 12.8 11.9 12.1 11.2 21.5 19V40.6c0-11.4-9.2-20.6-20.5-20.6zm-38.6 130.6s-3.6-4.3-6.6-8.1c13.1-3.7 18.1-11.9 18.1-11.9-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.5-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.7-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.3-1.8-1-2.8-1.7-2.8-1.7s4.8 8 17.5 11.8c-3 3.8-6.7 8.3-6.7 8.3-22.1-.7-30.5-15.2-30.5-15.2 0-32.2 14.4-58.3 14.4-58.3 14.4-10.8 28.1-10.5 28.1-10.5l1 1.2c-18 5.2-26.3 13.1-26.3 13.1s2.2-1.2 5.9-2.9c10.7-4.7 19.2-6 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.6 0 0-7.9-7.5-24.9-12.7l1.4-1.6s13.7-.3 28.1 10.5c0 0 14.4 26.1 14.4 58.3 0 0-8.5 14.5-30.6 15.2z"/>
</g>
</defs></svg>
</iron-iconset-svg>
80 changes: 80 additions & 0 deletions src/lancie-my-area/lancie-info-box.html
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;
Copy link
Contributor

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?

Copy link
Member Author

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

Copy link
Contributor

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?

Copy link
Member Author

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)

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>
169 changes: 139 additions & 30 deletions src/lancie-my-area/lancie-my-area.html
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 {
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Member Author

Choose a reason for hiding this comment

The 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

Copy link
Member

Choose a reason for hiding this comment

The 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 <slot> in lancie-info is a good idea for that

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) {
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if there are multiple tickets owned by the user?

Copy link
Contributor

Choose a reason for hiding this comment

The 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>
Loading