Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
minor style fixes and next level button
Browse files Browse the repository at this point in the history
  • Loading branch information
evermake committed Nov 30, 2024
1 parent 786fcb0 commit f985cc4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 16 deletions.
2 changes: 1 addition & 1 deletion frontend/src/api/me.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function useMe() {
{},
{
refetchInterval: 1000 * 60 * 5, // 5 minutes
retry: false
retry: false,
},
)

Expand Down
25 changes: 17 additions & 8 deletions frontend/src/components/mahjong/Mahjong.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { DotLottieWorker } from '@lottiefiles/dotlottie-react'
import type { Coordinate, Tile as TileT } from './game'
import { $api } from '@/api'
import { useMe } from '@/api/me'
import { getLevelById, type LevelInfo } from '@/components/mahjong/levels.ts'
import { getLevelById, type LevelInfo, levels } from '@/components/mahjong/levels.ts'
import { calculateScore } from '@/components/mahjong/score.ts'
import { Button } from '@/components/ui/button'
import { Card, CardContent, CardFooter, CardHeader, CardTitle } from '@/components/ui/card.tsx'
Expand Down Expand Up @@ -426,7 +426,7 @@ export function Mahjong({ level }: { level: LevelInfo }) {
</Dialog>

<Dialog open={finishResults !== null} onOpenChange={() => {}}>
<DialogContent className="max-h-[calc(100vh-2rem)] overflow-y-auto sm:max-w-[425px] lg:max-w-[625px]" noCloseIcon>
<DialogContent className="max-h-[calc(100vh-2rem)] min-w-0 max-w-[min(100%-24px,425px)] overflow-y-auto rounded-lg lg:max-w-[625px]" noCloseIcon>
<DialogHeader>
<DialogTitle>Поздравляем!</DialogTitle>
</DialogHeader>
Expand All @@ -451,6 +451,8 @@ function Results({
score?: number
}) {
const level = getLevelById(levelId)
const levelIndex = levels.findIndex(l => l.id === levelId)
const nextLevel = levels[levelIndex + 1]

const me = useMe()
const refSent = useRef(false)
Expand Down Expand Up @@ -540,7 +542,7 @@ function Results({
</div>
</CardContent>
<CardHeader className="px-4 py-2">
<CardTitle className="text-center text-lg">
<CardTitle className="text-center text-sm lg:text-lg">
Без подсказок!
</CardTitle>
</CardHeader>
Expand All @@ -555,7 +557,7 @@ function Results({
</div>
</CardContent>
<CardHeader className="px-4 py-2">
<CardTitle className="text-center text-lg">
<CardTitle className="text-center text-sm lg:text-lg">
Без лишних кликов!
</CardTitle>
</CardHeader>
Expand All @@ -570,7 +572,7 @@ function Results({
</div>
</CardContent>
<CardHeader className="px-4 py-2">
<CardTitle className="text-center text-lg">
<CardTitle className="text-center text-sm lg:text-lg">
Очень быстро!
</CardTitle>
</CardHeader>
Expand All @@ -585,7 +587,7 @@ function Results({
</div>
</CardContent>
<CardHeader className="px-4 py-2">
<CardTitle className="text-center text-lg">
<CardTitle className="text-center text-sm lg:text-lg">
Идеально!
</CardTitle>
</CardHeader>
Expand Down Expand Up @@ -625,8 +627,15 @@ function Results({
))}
</div>
</CardContent>
<CardFooter>
<Button asChild className="w-full">
<CardFooter className="flex gap-2">
{nextLevel && (
<Button asChild className="w-full">
<Link to="/info" search={{ level: nextLevel.id }}>
Следующий уровень
</Link>
</Button>
)}
<Button asChild className="w-full" variant="outline">
<Link to="/">
В меню
</Link>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/ui/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
const DialogContent = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & { noCloseIcon?: boolean}
>(({ className, children, ...props }, ref) => (
>(({ className, children, noCloseIcon, ...props }, ref) => (
<DialogPortal>
<DialogOverlay />
<DialogPrimitive.Content
Expand All @@ -41,7 +41,7 @@ const DialogContent = React.forwardRef<
{...props}
>
{children}
{!props.noCloseIcon && (
{!noCloseIcon && (
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
<span className="iconify ph--x h-4 w-4"></span>
<span className="sr-only">Close</span>
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ function RouteComponent() {
<div className="mt-8 flex justify-center">
<img src="/favicon.png" className="w-48" />
</div>
<h1 className="mb-8 mt-6 text-center text-4xl font-bold">
<h1 className="mb-8 mt-6 text-center text-3xl font-bold lg:text-4xl">
АВТОМАДЖИК
</h1>
<div className="mb-8 mt-6 px-4 text-center text-xl font-semibold">
<div className="mb-8 mt-6 px-4 text-center text-lg text-muted-foreground lg:text-xl">
Сыграйте в увлекательную игру и ближе познакомьтесь с ведущими автомобильными компаниями мира
</div>
<div className="flex flex-row flex-wrap justify-center gap-8">
Expand All @@ -49,8 +49,8 @@ function LevelCard({ level }: { level: LevelInfo }) {
const isUnlocked = !level.requiredLevel || results?.some(result => result.level_name === level.requiredLevel || result.level_name === level.id)

return (
<Card className="max-w-2xl bg-black bg-opacity-40 backdrop-blur-md transition-all hover:border-[#00D0C5]">
<CardHeader>
<Card className="flex max-w-[min(300px,100%-24px)] flex-col bg-black bg-opacity-40 backdrop-blur-md transition-all hover:border-[#00D0C5]">
<CardHeader className="grow">
<CardTitle>{level.title}</CardTitle>
<CardDescription>
{diceCount}
Expand All @@ -62,7 +62,7 @@ function LevelCard({ level }: { level: LevelInfo }) {
</CardDescription>
</CardHeader>
<CardContent>
<div className="mx-auto flex aspect-video h-[175px] items-center justify-center rounded-xl border border-[rgba(255,255,255,0.075)] bg-[#191919] p-2 shadow-inner lg:h-[200px]">
<div className="flex aspect-video w-full items-center justify-center rounded-xl border border-[rgba(255,255,255,0.075)] bg-[#191919] p-2 shadow-inner">
<img
src={`/preview/${level.id}.png`}
className="size-full rounded-xl object-contain object-center"
Expand Down

0 comments on commit f985cc4

Please sign in to comment.