Skip to content

Commit

Permalink
shrimpo cards styling
Browse files Browse the repository at this point in the history
  • Loading branch information
mcfiredrill committed Mar 11, 2024
1 parent 789ea01 commit e90c4d5
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 25 deletions.
52 changes: 33 additions & 19 deletions app/components/shrimpo/card.hbs
Original file line number Diff line number Diff line change
@@ -1,23 +1,37 @@
<div class="m-4 classic:bg-df-pink blm:bg-black rounded-lg border-4 border-white flex flex-col items-center justify-between w-full md:w-1/4 p-2 shadow-md">
<LinkTo
class="m-4 classic:bg-df-pink blm:bg-black rounded-lg border-4 border-white flex justify-between w-full p-2 shadow-md"
@route="home.shrimpos.show"
@model={{@shrimpo.slug}}>
<div>
{{#if @shrimpo.coverArtUrl}}
<img src={{@shrimpo.coverArtUrl}} />
{{else}}
<img src={{@shrimpo.user.avatarUrlOrDefault}} />
{{/if}}
</div>
<h2 class="text-xl">
<LinkTo @route="home.shrimpos.show" @model={{@shrimpo.slug}}>
{{@shrimpo.title}}
</LinkTo>
</h2>
<div>
{{@shrimpo.entriesCount}} entries
<div>
{{#if @shrimpo.coverArtUrl}}
<img
style="height: 6rem;"
src={{@shrimpo.coverArtUrl}}
/>
{{else}}
<img src={{@shrimpo.user.avatarUrlOrDefault}} />
{{/if}}
</div>
<div class="flex flex-col">
<h2 class="text-xl">
{{@shrimpo.title}}
</h2>
<div class="text-white">
{{@shrimpo.entriesCount}} entries
</div>
</div>
</div>
<div>
{{@shrimpo.status}}
<div class="text-white font-bold">
{{@shrimpo.status}}
</div>
{{#if (eq @shrimpo.status 'running')}}
<Shrimpo::Countdown @endAt={{@shrimpo.endAt}} />
{{/if}}
<div class="text-white">
<span class="font-bold">Host:</span>
{{@shrimpo.username}}
</div>
</div>
{{#if (eq @shrimpo.status 'running')}}
<Shrimpo::Countdown @endAt={{@shrimpo.endAt}} />
{{/if}}
</div>
</LinkTo>
4 changes: 3 additions & 1 deletion app/components/shrimpo/countdown.hbs
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
Time left: {{this.currentTimeLeft}}
<span class="text-white">
Time left: {{this.currentTimeLeft}}
</span>
12 changes: 12 additions & 0 deletions app/controllers/home/shrimpos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ export default class HomeShrimpos extends Controller {
return !shrimpo.isNew;
});
}

get currentShrimpos() {
return this.model.filter((shrimpo: any) => {
return !shrimpo.isNew && (shrimpo.status === 'running' || shrimpo.status === 'voting');
});
}

get completedShrimpos() {
return this.model.filter((shrimpo: any) => {
return !shrimpo.isNew && shrimpo.status === 'completed';
});
}
}

// DO NOT DELETE: this is how TypeScript knows how to look up your controllers.
Expand Down
16 changes: 11 additions & 5 deletions app/templates/home/shrimpos.hbs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<section class="page-spacing">
<h1 class="text-2xl">
THE POWER OF SHRIMPO<span class="ml-2 text-xs italic">beta</span> COMPELS YOU
<h1>
THE POWER OF SHRIMPO<span class="ml-2 text-lg italic">beta</span> COMPELS YOU
</h1>
<p>
Improve your skills. Create new music.
<p class="italic">
Improve your skills. Create new music.
</p>

{{#if this.session.isAuthenticated}}
Expand All @@ -14,7 +14,13 @@
</div>
{{/if}}

{{#each this.savedShrimpos as |shrimpo|}}
<h3>Shrimpos in Progress</h3>
{{#each this.currentShrimpos as |shrimpo|}}
<Shrimpo::Card @shrimpo={{shrimpo}} />
{{/each}}

<h3>Completed Shrimpos</h3>
{{#each this.completedShrimpos as |shrimpo|}}
<Shrimpo::Card @shrimpo={{shrimpo}} />
{{/each}}
</section>
1 change: 1 addition & 0 deletions app/validations/shrimpo-entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ import { validatePresence } from 'ember-changeset-validations/validators';

export default {
title: validatePresence(true),
audio: validatePresence(true),
};

0 comments on commit e90c4d5

Please sign in to comment.