Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 145 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"react-hook-form": "^7.53.1",
"react-hotkeys-hook": "^4.6.1",
"react-i18next": "^15.1.1",
"react-joyride": "^2.9.3",
"react-mosaic-component": "^6.1.1",
"react-resizable-panels": "^2.1.7",
"react-router-dom": "^6.26.2",
Expand Down
1 change: 1 addition & 0 deletions public/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ self.addEventListener('fetch', async (event) => {
'stockfish-16.1-single.wasm',
'stockfish-16.1-lite.wasm',
'stockfish-16.1-lite-single.wasm',
'castledEngine/CastledEngine_bg.wasm',
];

if (new RegExp(wasmUrls.join('|')).test(url.pathname)) {
Expand Down
25 changes: 25 additions & 0 deletions src/components/joyride/tooltip.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { TooltipRenderProps } from 'react-joyride';
import { Button } from '@/components/ui/button.tsx';

export const CustomJoyrideTooltip = (props: TooltipRenderProps) => {
const { backProps, continuous, index, primaryProps, skipProps, step, tooltipProps } = props;

return (
<div
className="h-max min-w-60 max-w-[40rem] p-6 flex bg-accent flex-col gap-4 rounded-lg overflow-hidden"
{...tooltipProps}
>
{step.title && <h4 className="text-xl">{step.title}</h4>}
<div className="flex flex-col gap-2">{step.content}</div>
<div className="flex justify-end gap-2 w-full">
<Button variant="outline" {...skipProps}>
{skipProps.title} Tutorial
</Button>
<div>
{index > 0 && <Button {...backProps}>{backProps.title}</Button>}
{continuous && <Button {...primaryProps}>{primaryProps.title}</Button>}
</div>
</div>
</div>
);
};
12 changes: 12 additions & 0 deletions src/data/tutorial.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export const dashboardSteps = [
{
target: '.dashboard-table',
title: 'Welcome to Castled!',
content: 'This is the game history table. Where you can view and manage every analysis you have made.',
},
{
target: '.start-analysis',
title: 'Start a new analysis',
content: 'Click on the "New Analysis" button to start a new analysis.',
},
];
18 changes: 15 additions & 3 deletions src/lib/analysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { z } from 'zod';
import { AnalysisMove, AnalysisMoveClassification, InfoResult } from '@/types/analysis.ts';
import { AnalysisMethod, StartAnalysisFormSchema } from '@/schema/analysis.ts';
import { Move } from 'chess.js';
import { StockfishService } from '@/services/stockfish/stockfish.service.ts';
import { UciParserService } from '@/services/stockfish/uci-parser.service.ts';
import { EngineService } from '@/services/engine/engine.service.ts';
import { UciParserService } from '@/services/engine/uci-parser.service.ts';
import { isCached } from '@/services/cache/cache.service.ts';

export type AnalyseMovesLocalParams = {
Expand All @@ -16,6 +16,7 @@ export type Engine = {
isMultiThreaded: boolean;
name: string;
value: string;
workerURL: string | URL;
cache: string;
};

Expand All @@ -24,26 +25,37 @@ export const Engines: Engine[] = [
isMultiThreaded: true,
name: 'Stockfish 16.1 Large Multi-Threaded',
value: 'stockfish-16.1.js',
workerURL: 'stockfish-16.1.js',
cache: 'stockfish-16.1.wasm',
},
{
isMultiThreaded: false,
name: 'Stockfish 16.1 Large Single-Threaded',
value: 'stockfish-16.1-single.js',
workerURL: 'stockfish-16.1-single.js',
cache: 'stockfish-16.1-single.wasm',
},
{
isMultiThreaded: true,
name: 'Stockfish 16.1 Lite Multi-Threaded',
value: 'stockfish-16.1-lite.js',
workerURL: 'stockfish-16.1-lite.js',
cache: 'stockfish-16.1-lite.wasm',
},
{
isMultiThreaded: false,
name: 'Stockfish 16.1 Lite Single-Threaded',
value: 'stockfish-16.1-lite-single.js',
workerURL: 'stockfish-16.1-lite-single.js',
cache: 'stockfish-16.1-lite-single.wasm',
},
{
isMultiThreaded: false,
name: 'Castled Engine Single-Threaded',
value: 'castledEngine/CastledEngine.js',
workerURL: new URL('../workers/engine.ts', import.meta.url),
cache: 'castledEngine/CastledEngine_bg.wasm',
},
];

/**
Expand Down Expand Up @@ -72,7 +84,7 @@ export const analyseMovesLocal = ({
data,
reportProgress,
}: AnalyseMovesLocalParams): Promise<AnalysisMove>[] => {
const stockfish = new StockfishService({
const stockfish = new EngineService({
engine: data.engine,
threads: data.threads,
hashSize: data.analysisSettings.hashSize,
Expand Down
1 change: 1 addition & 0 deletions src/schema/analysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const StartAnalysisFormSchema = z.object({
isMultiThreaded: z.boolean(),
name: z.string(),
value: z.string(),
workerURL: z.string().or(z.instanceof(URL)),
cache: z.string(),
}),
threads: z
Expand Down
Loading
Loading