Skip to content

Commit

Permalink
style: improve UI elements for new analysis dropdowns (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinjosethomas authored Nov 23, 2024
1 parent ca4a408 commit 1a43923
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 7 deletions.
10 changes: 10 additions & 0 deletions src/api/analysis/analysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,16 @@ export const getAnalyzedUserGame = async (
const blackPlayer = data['black_player']
const whitePlayer = data['white_player']

const maiaPattern = /maia_kdd_1\d00/

if (maiaPattern.test(blackPlayer.name)) {
blackPlayer.name = blackPlayer.name.replace('maia_kdd_', 'Maia ')
}

if (maiaPattern.test(whitePlayer.name)) {
whitePlayer.name = whitePlayer.name.replace('maia_kdd_', 'Maia ')
}

const maiaEvaluations: { [model: string]: MoveMap[] } = {}
const positionEvaluations: { [model: string]: PositionEvaluation[] } = {}
const availableMoves: AvailableMoves[] = []
Expand Down
32 changes: 25 additions & 7 deletions src/components/Analysis/AnalysisGameList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,25 +101,43 @@ const AnalysisGameList: React.FC<AnalysisGameListProps> = ({
<div className="flex min-h-12 w-full items-center justify-center overflow-hidden bg-background-2">
<button
onClick={() => setSelected('pgn')}
className={`relative z-10 flex h-full w-full items-center justify-center py-2 pb-3 transition duration-300 hover:bg-background-3 ${['pgn', 'hand', 'brain', 'play'].includes(selected) && 'bg-background-5'}`}
className={`relative z-10 flex h-full w-full items-center justify-center gap-1 py-2 pb-3 transition duration-300 ${selected !== 'tournament' ? 'bg-human-4/40' : 'hover:bg-background-3'}`}
>
<p className="z-10 font-medium text-primary">Your Games</p>
{['pgn', 'hand', 'brain', 'play'].includes(selected) && (
<p
className={`z-10 font-medium transition duration-200 ${selected !== 'tournament' ? 'text-human-1' : 'text-primary'}`}
>
Your Games
</p>
<i
className={`material-symbols-outlined text-lg transition duration-200 ${selected !== 'tournament' ? 'text-human-1' : 'text-primary/80'}`}
>
keyboard_arrow_down
</i>
{selected !== 'tournament' && (
<motion.div
layoutId="selected-highlight"
className="absolute bottom-0 left-0 h-1 w-full rounded bg-primary"
className="absolute bottom-0 left-0 h-1 w-full rounded bg-human-2/80"
/>
)}
</button>
<button
onClick={() => setSelected('tournament')}
className={`relative z-10 flex h-full w-full items-center justify-center py-2 pb-3 transition duration-300 hover:bg-background-3 ${selected === 'tournament' && 'bg-background-5'}`}
className={`relative z-10 flex h-full w-full items-center justify-center gap-1 py-2 pb-3 transition duration-300 ${selected === 'tournament' ? 'bg-human-4/40' : 'hover:bg-background-3'}`}
>
<p className="z-10 font-medium text-primary">WC Matches</p>
<p
className={`z-10 font-medium transition duration-200 ${selected === 'tournament' ? 'text-human-1' : 'text-primary'}`}
>
WC Matches
</p>
<i
className={`material-symbols-outlined text-lg transition duration-200 ${selected === 'tournament' ? 'text-human-1' : 'text-primary/80'}`}
>
keyboard_arrow_down
</i>
{selected === 'tournament' && (
<motion.div
layoutId="selected-highlight"
className="absolute bottom-0 left-0 h-1 w-full rounded bg-primary"
className="absolute bottom-0 left-0 h-1 w-full rounded bg-human-2/80"
/>
)}
</button>
Expand Down

0 comments on commit 1a43923

Please sign in to comment.