-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #143 from NetrunnerDB/upgrade-dependencies
Upgrade dependencies
- Loading branch information
Showing
9 changed files
with
1,125 additions
and
1,063 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import Component from '@glimmer/component'; | ||
import CardLinkTo from '../card/link-to'; | ||
import Icon from '../icon'; | ||
import { get } from '@ember/helper'; | ||
import { Range } from 'netrunnerdb/helpers/range'; | ||
|
||
export default class DecklistImages extends Component { | ||
cardsByType = (cardType) => { | ||
let cards = this.args.decklist.cards; | ||
|
||
return cards.filter(({ cardTypeId }) => cardTypeId === cardType); | ||
}; | ||
|
||
countByType = (cardType) => { | ||
let cardSlots = this.args.decklist.cardSlots; | ||
|
||
return this.cardsByType(cardType) | ||
.map((card) => cardSlots[card.id]) | ||
.reduce((acc, i) => acc + i); | ||
}; | ||
|
||
<template> | ||
{{#each @cardTypes as |type|}} | ||
{{#let (this.cardsByType type.id) as |cards|}} | ||
{{#if cards}} | ||
<h3 class='mt-4 font-size-20'> | ||
<Icon @icon='{{type.id}}' /> | ||
{{type.name}} | ||
({{this.countByType type.id}}) | ||
</h3> | ||
<div class='row row-cols-8 g-3'> | ||
{{#each cards as |card|}} | ||
<div class='col'> | ||
<CardLinkTo @printing={{card.latestPrinting}}> | ||
<div class='decklist-card'> | ||
{{#each (Range (get @decklist.cardSlots card.id))}} | ||
<img | ||
src='{{card.latestPrinting.largeImage}}' | ||
alt={{card.title}} | ||
/> | ||
{{/each}} | ||
</div> | ||
</CardLinkTo> | ||
</div> | ||
{{/each}} | ||
</div> | ||
{{/if}} | ||
{{/let}} | ||
{{/each}} | ||
</template> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
import { helper } from '@ember/component/helper'; | ||
|
||
function formatDate(date) { | ||
export function formatDate(date) { | ||
return new Intl.DateTimeFormat('en-GB') | ||
.format(new Date(date)) | ||
.replaceAll('/', '-'); | ||
} | ||
|
||
export const FormatDate = formatDate; | ||
export default helper(formatDate); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.