feat: přidání K-ON! theme
CI / Generate TypeScript types (push) Successful in 11s
CI / Server unit tests (push) Successful in 27s
CI / Build server (push) Successful in 29s
CI / Build client (push) Successful in 42s
CI / Playwright E2E tests (push) Successful in 1m52s
CI / Build and push Docker image (push) Successful in 46s
CI / Notify (push) Successful in 2s
CI / Generate TypeScript types (push) Successful in 11s
CI / Server unit tests (push) Successful in 27s
CI / Build server (push) Successful in 29s
CI / Build client (push) Successful in 42s
CI / Playwright E2E tests (push) Successful in 1m52s
CI / Build and push Docker image (push) Successful in 46s
CI / Notify (push) Successful in 2s
This commit is contained in:
10 files changed
+873
-12
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { OverlayTrigger, Tooltip } from "react-bootstrap";
|
||||
import { useSettings } from "../context/settings";
|
||||
import { StyleTheme, useSettings } from "../context/settings";
|
||||
import { UmaCharacter, loadUmaCharacters } from "../utils/umaCharacters";
|
||||
import "./EaterBadge.scss";
|
||||
|
||||
@@ -25,12 +25,25 @@ const HG_LEVELS = [
|
||||
{ minItems: 2, emoji: '🥀', title: 'Úroveň Ai Enma — tichý, ale nenasytný apetit' },
|
||||
];
|
||||
|
||||
/** Úrovně ve stylu K-ON! — emoji v odznaku jako trsátko. Seřazeno od nejvyšší úrovně. */
|
||||
const KON_LEVELS = [
|
||||
{ minItems: 3, emoji: '🍰', title: 'Úroveň Yui — sní všechno a nepřibere ani gram' },
|
||||
{ minItems: 2, emoji: '☕', title: 'Úroveň Tea Time — k obědu ještě čaj a dortík' },
|
||||
];
|
||||
|
||||
/** Úrovně podle stylu pro odznaky s emoji. */
|
||||
const EMOJI_LEVELS: Partial<Record<StyleTheme, typeof MLP_LEVELS>> = {
|
||||
mlp: MLP_LEVELS,
|
||||
hellgirl: HG_LEVELS,
|
||||
kon: KON_LEVELS,
|
||||
};
|
||||
|
||||
type Props = {
|
||||
/** Počet jídel/položek, které si strávník vybral či objednal */
|
||||
items: number,
|
||||
};
|
||||
|
||||
/** Odznak s postavou u strávníků s více jídly — jen ve stylech Umamusume, My Little Pony a Hell Girl. */
|
||||
/** Odznak s postavou u strávníků s více jídly — jen ve stylech Umamusume, My Little Pony, Hell Girl a K-ON!. */
|
||||
export default function EaterBadge({ items }: Readonly<Props>) {
|
||||
const styleTheme = useSettings()?.styleTheme;
|
||||
const isUma = styleTheme === 'umamusume';
|
||||
@@ -40,8 +53,9 @@ export default function EaterBadge({ items }: Readonly<Props>) {
|
||||
if (isUma) loadUmaCharacters().then(setCharacters);
|
||||
}, [isUma]);
|
||||
|
||||
if (styleTheme === 'mlp' || styleTheme === 'hellgirl') {
|
||||
const emojiLevel = (styleTheme === 'mlp' ? MLP_LEVELS : HG_LEVELS).find(l => items >= l.minItems);
|
||||
const emojiLevels = styleTheme && EMOJI_LEVELS[styleTheme];
|
||||
if (emojiLevels) {
|
||||
const emojiLevel = emojiLevels.find(l => items >= l.minItems);
|
||||
if (!emojiLevel) return null;
|
||||
return (
|
||||
<OverlayTrigger placement="top" overlay={<Tooltip>{emojiLevel.title} ({items} jídla)</Tooltip>}>
|
||||
|
||||
Reference in new issue
Block a user