Commit Graph

846 Commits

Author SHA1 Message Date
dioxide
7d5a07c106 Add new enumerate AnswerType, which differs the input data structure.
Add new key isRandom to determine whether the random system works.
Add new keys answerType, which is the type of AnswerType Array to keep record the types of input, and lengthOfArray.
Complete the first edition of random array generate.
2025-06-16 22:45:31 +08:00
dioxide
3aa0a52b9e Add random function to help create a series of test.
Add the answerType key to restrict the type of answer.
Add the lengthOfArray key to rule the length of array or matrix. While if a single number just put null.
Add new content of seed.ts like above all.
2025-06-16 14:06:49 +08:00
dioxide
7f79b901b7 Add trim function to ignore the whitespace character.
Add a trim key to mark whether the answer should be trimmed.
Add a judgement to determine whether the trim should work.
2025-06-15 17:16:39 +08:00
941f1a74fa feat: replace dockview with flexlayout-react 2025-06-13 14:03:17 +08:00
03f150214d chore(prisma): make TestcaseResult.output nullable in migration 2025-05-16 10:43:48 +08:00
23a7e2e69e fix(prisma): make TestcaseResult.output field optional 2025-05-16 10:42:20 +08:00
9443ab6d6d refactor(api): extract OpenAI client to shared module 2025-05-14 22:30:45 +08:00
1c031ce24e refactor(judge-button): migrate run code button to standalone component
- Replace RunCodeButton with new JudgeButton component
- Use problem-specific stores instead of playground stores
- Implement new judge toast notification system
- Simplify authentication check logic
- Utilize new TooltipButton component
2025-05-14 17:04:03 +08:00
4ca6840bbd refactor(problems): consolidate judge status toast
- Migrate status toast from shared hooks to problems feature
- Remove deprecated show-status-toast.tsx and status.ts
- Implement self-contained JudgeToast component with built-in status mapping
2025-05-14 16:09:13 +08:00
9003e4b5a4 refactor(components): simplify BackButton by using TooltipButton 2025-05-13 17:38:26 +08:00
2e74ffbac3 refactor(config): migrate editor options to standalone editor config
- Rename `editor-language.ts` to `editor.ts`
- Update interface from `IEditorConstructionOptions` to `IStandaloneEditorConstructionOptions`
- Keep all existing editor options unchanged
2025-05-13 16:57:35 +08:00
49419654a0 feat(problemset): enhance header component with back button and className prop
- Replace problem-header.tsx with new header.tsx implementation
- Add BackButton functionality to navigate to home page
- Make className prop configurable using cn utility
- Maintain existing user avatar functionality
2025-05-13 16:47:11 +08:00
9766dea138 refactor(back-button): relocate and rename back button component
- Move from features/problems/components to shared components directory
- Rename NavigateBackButton to simpler BackButton
- Update component interface naming to BackButtonProps
- Keep all existing functionality intact
2025-05-13 16:43:01 +08:00
ad8a3e646e feat(code-panel): add code editor panel components
- Add CodePanel component as container for editor interface
- Add CodeContent component with Prisma data fetching
- Include CodeContentSkeleton for loading state
- Implement ProblemEditor integration with templates
2025-05-13 16:37:35 +08:00
33930e7a33 chore(utils): remove unused utility functions
- Remove getPath function (moved to problem-editor store)
- Remove getDifficultyColorClass function (unused)
- Keep only core cn utility function
2025-05-13 16:34:28 +08:00
bcdd72317c feat(store): add problem editor state management
- Create problem-editor store with Zustand
- Manage editor state including problem, language, value and path
- Implement localStorage persistence for editor content
- Provide utility functions for language and value retrieval
2025-05-13 16:31:38 +08:00
5aec2ec323 refactor(mdx-render): simplify theme configuration and change export style
- Remove custom Monaco theme imports
- Use github default themes for rehypePrettyCode
- Change component export from default to named export
2025-05-13 16:27:46 +08:00
ba1937ecbb refactor(problems): update ProblemHeader import path to new location 2025-05-13 16:14:57 +08:00
aec8393d2d feat(dockview): export Dockview component and create ProblemDockview wrapper
- Export Dockview component from src/components/dockview.tsx to make it reusable
- Create new ProblemDockview component in src/features/problems/components/dockview.tsx that:
  - Integrates with next-intl for locale handling
  - Connects to problem-dockview store
  - Wraps Dockview with problem-specific configuration
  - Adds locale-based key for proper re-rendering
- Maintain existing Dockview functionality including:
  - Layout persistence
  - Panel management
  - API handling
2025-05-13 16:08:33 +08:00
148ae677d7 refactor(problemset): move components to separate files and improve structure
- Move ProblemsetHeader component from 'problemset-header' to 'header'
- Extract problemset table logic into dedicated ProblemsetTable component
- Add Suspense and skeleton loading for better UX
- Update layout and page structure
2025-05-13 16:03:46 +08:00
0e3daefe48 feat(config): add LANGUAGES constant for language enum values 2025-05-13 16:00:52 +08:00
f6ed0baaf0 refactor(prisma): simplify prisma client initialization and remove caching
Removed all caching and logging functionality from prisma.ts, keeping only
the basic Prisma client initialization logic. This includes:
- Removal of getProblems, getCachedProblems, getProblem, getCachedProblem functions
- Removal of related logger and cache imports
- Simplified the global prisma client instantiation
2025-05-13 15:59:57 +08:00
f9cbc5e085 refactor(code-toolbar): standardize component exports and simplify reset logic
- Changed all toolbar action components from named exports with curly braces to default exports
- Simplified ResetButton by moving template logic to useProblemEditorActions hook
- Updated useProblemEditorActions to handle template selection internally using store data
- Renamed problem-editor-store import to problem-editor for consistency
2025-05-13 15:56:28 +08:00
eea16a8224 feat(problems): add localization support for problem descriptions and solutions
- Replace cached problem data with direct Prisma queries for localized content
- Implement locale-based content selection for both descriptions and solutions
- Refactor skeleton loading components structure
- Change all exports from named to default exports
2025-05-13 15:36:07 +08:00
ad2aca2f67 refactor(language-selector): migrate to new location and implementation
- Remove old language selector from `src/components/features/playground/workspace/editor/components`
- Add new implementation in `src/features/problems/code/components/toolbar/controls`
- Update toolbar exports to include the new selector
2025-05-13 15:18:59 +08:00
cea0027799 refactor(shiki): migrate to shiki/core with lazy initialization
- Replace shiki with shiki/core for better tree-shaking
- Change highlighter initialization to explicit theme/lang imports
- Export getHighlighter function instead of direct highlighter instance
- Add error handling for uninitialized highlighter access
2025-05-13 14:48:32 +08:00
2efdc21419 refactor(i18n): replace language-settings with locale-switcher
- Replace react-world-flags with next/image for better optimization
- Simplify locale handling logic and remove unused getUserLocale
- Rename component to be more descriptive (language-settings -> locale-switcher)
- Update all references to use the new component
- Add proper SVG flag assets for supported locales
- Remove react-world-flags dependency from package.json
2025-05-13 00:19:01 +08:00
2e2e0315a8 refactor(hooks): remove theme config and simplify theme hook
- Delete src/config/monaco-theme.ts and src/types/monaco-theme.ts
- Simplify useMonacoTheme hook to directly return theme strings
- Format use-mobile.ts with consistent semicolons and quotes
2025-05-12 21:19:05 +08:00
01b72209ae refactor(i18n): migrate locale configuration to generated types
- Replace hardcoded locale strings with generated Locale enum from client
- Update cookie key name to be more specific (LOCALE_COOKIE_NAME -> JUDGE4C_LOCALE_KEY)
- Rename defaultLocale to DEFAULT_LOCALE for consistency
- Add 'server-only' imports to ensure server-side usage
- Simplify locale validation using Object.values(Locale)
- Clean up accept-language header parsing logic
2025-05-12 21:07:43 +08:00
4cc6456151 refactor(prisma): simplify schema and remove zod-prisma-types
- Reorganized Prisma schema structure with simplified models and relations
- Removed zod-prisma-types generator as it's no longer needed
- Consolidated problem content types into a single ProblemLocalization model
- Simplified testcase and template structures
- Removed unused prisma types file
2025-05-12 19:41:28 +08:00
15b3f630d5 refactor(prisma): simplify schema and remove zod-prisma-types
- Reorganized Prisma schema structure with simplified models and relations
- Removed zod-prisma-types generator as it's no longer needed
- Consolidated problem content types into a single ProblemLocalization model
- Simplified testcase and template structures
- Removed unused prisma types file
2025-05-12 18:32:46 +08:00
0e9207bfce chore(scripts): remove --turbopack flag from dev script 2025-05-12 11:22:31 +08:00
9ec8768393 chore(shiki): convert function to arrow function 2025-05-09 09:42:24 +08:00
baf377b722 refactor(loading): change to named export and arrow function
- Switch from default export to named export
- Convert component to arrow function
- Remove unused props parameter
2025-05-09 09:40:25 +08:00
7e45010487 fix(styles): adjust tabs overflow container height in abyss theme
Changed height property from 'unset !important' to '100%' for .dv-tabs-overflow-container and .dv-tabs-overflow-dropdown-default in the abyss-spaced theme to fix layout issues.
2025-05-08 11:27:10 +08:00
25fd9b5f46 chore(prisma/migrations): add migration for multilingual problem support 2025-05-07 21:09:35 +08:00
cfbbdbf821 feat(prisma/schema): add multilingual support for problem descriptions and solutions
BREAKING CHANGE:
- Removed `description` and `solution` fields from Problem model
- Added new models `ProblemDescription` and `ProblemSolution` with language support (EN/ZH)
- Updated seed data structure to support multilingual content
- Requires database migration and data migration from old structure
2025-05-07 21:04:46 +08:00
f0beb69b2c fix(page): add missing return statement in RootPage component 2025-05-07 16:42:39 +08:00
f93224f56e chore(components): remove unused problem-related components
- Delete footer.tsx from problem/description
- Delete solution.tsx from problem/description
- Delete header.tsx from problem/workspace/editor/components
2025-05-07 14:59:17 +08:00
b67b13d7bf refactor(route): rename [id] to [problemId] in problems route 2025-05-07 14:59:17 +08:00
1db666a2ab refactor(structure): reorganize page and component exports
- Move root page from /(app) to / directory
- Convert default exports to named exports in components
- Rename MainView component to HeroSection for better semantics
2025-05-07 14:06:31 +08:00
3417d2ee49 refactor(editor): consolidate editor toolbar actions into unified structure
- Moved all editor action buttons (copy, format, undo, redo, reset) from `src/components/features/playground/workspace/editor/components/` to new location `src/features/problems/code/components/toolbar/actions/`
- Introduced shared `TooltipButton` component to reduce duplication
- Created centralized `useProblemEditorActions` hook for common editor operations
- Updated imports and exports through new index file
- Maintained all existing functionality while improving code organization
2025-05-07 13:42:08 +08:00
6c9351ccd2 feat(components): add TooltipButton component
- A reusable button with tooltip functionality
- Supports customizable delay, tooltip content, and className
- Uses shadcn/ui Tooltip and Button components
2025-05-07 13:32:26 +08:00
2e19c08e8b refactor(mdx-renderer): simplify component implementation
- Remove Suspense and Skeleton loading state
- Convert to arrow function syntax
- Reorganize import statements
- Simplify export syntax
2025-05-07 13:31:02 +08:00
2c7223a323 feat(prisma): add server-only caching for problems queries
- Add 'server-only' import to enforce server-side usage
- Implement cached problem queries with logging:
  - Add getProblems/getCachedProblems for all problems
  - Add getProblem/getCachedProblem for single problem by ID
- Use React cache and Next.js unstable_cache with tags
- Add detailed logging with timing metrics
2025-05-06 21:33:37 +08:00
aed942e7e2 refactor(layouts): overhaul problem and problemset page structures
- Simplify ProblemLayout to use children prop and remove ProblemStoreProvider
- Replace PlaygroundHeader with dedicated ProblemHeader component
- Streamline ProblemsetLayout with new ProblemsetHeader
- Remove deprecated BackButton in favor of NavigateBackButton
- Delete unused ProblemStoreProvider and related dependencies
2025-05-06 21:22:13 +08:00
829370fafd chore(problems): move problem-dockview to components directory 2025-05-06 19:47:02 +08:00
5f3eb72d00 refactor(problems): migrate description and solution to feature-based structure
- Remove old parallel route implementations (@Description and @Solutions)
- Add new feature-based components for problem description and solution
  - Create content and panel components for both features
  - Implement skeleton loading states
  - Use cached data fetching
- Update MDX rendering and scroll area implementations
2025-05-06 19:38:50 +08:00
f464fb7636 feat(dockview): refactor dockview component and add problem-specific implementation
- Refactor Dockview component into more modular structure:
  - Extract layout persistence logic to custom hook
  - Extract component conversion logic to custom hook
  - Make storageKey optional
  - Improve type safety with PanelParams interface
  - Add better error handling and duplicate panel detection
- Add new ProblemDockview wrapper component:
  - Integrates with problem-dockview store
  - Adds locale awareness
  - Provides standardized storage key
- Update related type definitions and imports
2025-05-06 18:45:08 +08:00
c182452dd0 refactor(stores): split dockview store into problem-specific store
- Remove generic dockview store (`src/stores/dockview.tsx`)
- Add problem-specific dockview store (`src/stores/problem-dockview.tsx`)
- Remove submission-related state as it's no longer needed
2025-05-06 18:37:39 +08:00