Commit Graph

56 Commits

Author SHA1 Message Date
5af9d88db7
feat: update main branch (#45)
Some checks failed
Build & Push Judge4c Docker Image / build-and-push-judge4c-docker-image (., Dockerfile, judge4c) (push) Failing after 17s
* chore(deps): add pino and pino-pretty packages

* feat(log): add pino logging support

* chore(tailwind): update config with features path and animate import

* chore(deps): add react-icons package

* refactor(auth)!: replace credentials with OAuth providers and add logging

BREAKING CHANGE:
- Removed credentials-based authentication
- Added Google OAuth provider
- Implemented detailed logging for auth events
- Removed custom JWT/session handling
- Added sign-in page configuration
- Marked as server-only

* refactor(auth)!: remove components and rewrite sign-in page

* feat(user-avatar): refactor avatar component into user-avatar with improved structure

* style(dockview): reduce tabs container height and center align items

- Changed --dv-tabs-and-actions-container-height from 44px to 36px
- Added align-items: center to .dv-tabs-container
- Improved CSS formatting for better readability

* 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

* 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

* 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

* chore(problems): move problem-dockview to components directory

* 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

* 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

* refactor(mdx-renderer): simplify component implementation

- Remove Suspense and Skeleton loading state
- Convert to arrow function syntax
- Reorganize import statements
- Simplify export syntax

* 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

* 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

* 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

* refactor(route): rename [id] to [problemId] in problems route

* 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

* fix(page): add missing return statement in RootPage component

* 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

* chore(prisma/migrations): add migration for multilingual problem support

* 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.

* 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

* chore(shiki): convert function to arrow function

* chore(scripts): remove --turbopack flag from dev script

* 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

* 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

* 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

* 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

* 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

* 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

* 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

* 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

* 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

* 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

* feat(config): add LANGUAGES constant for language enum values

* 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

* 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

* refactor(problems): update ProblemHeader import path to new location

* 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

* 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

* chore(utils): remove unused utility functions

- Remove getPath function (moved to problem-editor store)
- Remove getDifficultyColorClass function (unused)
- Keep only core cn utility function

* 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

* 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

* 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

* 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

* refactor(components): simplify BackButton by using TooltipButton

* 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

* 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

* refactor(api): extract OpenAI client to shared module

* fix(prisma): make TestcaseResult.output field optional

* chore(prisma): make TestcaseResult.output nullable in migration

* feat: replace dockview with flexlayout-react
2025-06-21 06:09:57 +00:00
0b3086f333 chore(seed): add seed data for problem templates 2025-04-15 23:07:47 +08:00
59ba12258c bugs: change template to support code-run feature 2025-04-15 20:50:49 +08:00
81f89f7b16 refactor(schema): rename TestcaseResult fields to camelCase 2025-04-14 11:33:19 +08:00
fd50e72518 fix(prisma): rename Submission relations to submissions for consistency 2025-04-13 11:13:18 +08:00
24f78ab811 chore(prisma): add seed data for testcase_result model 2025-04-11 15:57:24 +08:00
2de1674b22 feat(prisma): add testcase_result model and related relations 2025-04-11 15:56:24 +08:00
1c0612372b feat(prisma): add TestcaseResult model and relations to Submission and Testcase 2025-04-11 15:53:56 +08:00
5e3b75a36b feat(prisma): add submission table and related relations 2025-04-10 22:26:45 +08:00
7dbf06b99f feat(prisma): add user and problem relations to Submission model 2025-04-10 22:24:40 +08:00
82428bbd09 chore(seed): remove timeLimit and memoryLimit from DockerConfig data 2025-04-10 21:57:11 +08:00
17c6be8a65 feat(prisma): migrate timeLimit and memoryLimit to Problem model 2025-04-10 21:55:32 +08:00
feee3a2580 feat(prisma): move timeLimit and memoryLimit from DockerConfig to Problem model 2025-04-10 21:54:30 +08:00
c4e9c5b566 feat(seed): add expected output for test data 2025-04-10 10:39:24 +08:00
e2914d1e18 feat(schema): add expectedOutput field to Testcase model 2025-04-10 10:19:17 +08:00
11fac9b3d6 feat(prisma): add expectedOutput field to Testcase model 2025-04-10 10:16:05 +08:00
51b9d7fa72 feat(seed): add testcases for test data 2025-04-09 21:13:26 +08:00
1813d4ed79 chore(prisma): migrate to add Testcase and TestcaseData models 2025-04-09 19:31:51 +08:00
521a185d7c feat(prisma): add Testcase and TestcaseData models with relation to Problem 2025-04-09 19:28:00 +08:00
750fb74653 chore(imports): update imports to use @/generated/client instead of @prisma/client 2025-04-01 11:46:25 +08:00
042db54185 chore(prisma): add zod generator and update output paths in schema 2025-04-01 01:57:15 +08:00
aec5ed5b8b feat(seed): add displayId for test data 2025-03-30 18:43:47 +08:00
eafd5c4ca4 chore(prisma): migrate schema to add displayId field in Problem model 2025-03-30 18:43:00 +08:00
89ebfc0c3a feat(prisma): add unique displayId field to Problem model 2025-03-30 18:39:53 +08:00
e1ce93346a feat(seed): add videos, images, and accordion hints for test data 2025-03-27 14:10:03 +08:00
3fefee674b chore(prisma): apply migration to remove TEACHER and STUDENT roles 2025-03-21 11:18:44 +08:00
190431ece6 chore(prisma): remove TEACHER and STUDENT roles 2025-03-21 11:11:24 +08:00
10a648feb3 refactor(prisma): update language server protocol to use LanguageServerProtocol enum 2025-03-18 14:47:33 +08:00
3e4b396bfe chore(prisma): add migration for language server protocol enum 2025-03-18 11:46:11 +08:00
adc195d4bf feat(schema): add LanguageServerProtocol enum and update protocol field type in LanguageServerConfig 2025-03-18 11:43:54 +08:00
ea92ba9d67 feat(seed): update seed data to add editor language configurations 2025-03-16 19:43:21 +08:00
c32704af27 chore(prisma): run prisma migrate to add JudgeResult model 2025-03-16 19:07:55 +08:00
a4f377037b feat(prisma): add JudgeResult model to store execution results 2025-03-16 19:05:16 +08:00
eef2df3eb4 feat(prisma): add ExitCode enum to schema 2025-03-16 17:13:57 +08:00
2e7f9540fe feat(prisma): add ExitCode enum for handling problem outcomes 2025-03-16 17:11:29 +08:00
d67ddf6882 chore(prisma): run migration to add DockerConfig to EditorLanguageConfig 2025-03-16 16:45:59 +08:00
aa34320295 feat(prisma): add DockerConfig model and update EditorLanguageConfig for Docker integration 2025-03-16 16:44:55 +08:00
4d13ba2c6d feat(prisma): add LanguageServerConfig model and relationship with EditorLanguageConfig 2025-03-16 14:39:23 +08:00
eb7943ab7e feat(prisma): refactor Prisma schema to remove circular relation and simplify EditorLanguageConfig and LanguageServerConfig models 2025-03-16 14:37:25 +08:00
4dbf6d774b chore(prisma): apply migration to remove id field from EditorLanguageConfig model 2025-03-16 14:12:02 +08:00
1bfa119b52 feat(prisma): remove id field from EditorLanguageConfig model and set language as unique 2025-03-16 14:09:34 +08:00
649637cceb chore(prisma): apply migration for editor language config model 2025-03-16 13:47:06 +08:00
ae97115d24 feat(prisma): add model to store language configurations 2025-03-16 13:46:09 +08:00
dbc1e8b814 chore(prisma): run migration for credentials-based auth changes 2025-03-14 00:18:56 +08:00
eac20c8882 feat(prisma): allow nullable email/name and add password field in User model 2025-03-14 00:17:29 +08:00
6a0937390c chore(prisma): generate migration for authentication schema changes 2025-03-12 15:11:05 +08:00
a3900d7c9c feat(prisma): refactor schema to support authentication and relational data 2025-03-12 15:09:01 +08:00
a5b5584e1c feat(prisma): add initial migration 2025-03-11 15:53:43 +08:00
02b75be71d feat(prisma): add solution field to problems during seed data creation 2025-03-10 22:50:33 +08:00
c0f72a21dd feat(prisma): add solution field to Problem model 2025-03-10 20:44:32 +08:00