Skip to content

refactor: modular type extraction, design tokens, API layer, mobile layout fix - #2

Draft
iPycc with Copilot wants to merge 2 commits into
mainfrom
copilot/refactor-front-end-project-structure
Draft

refactor: modular type extraction, design tokens, API layer, mobile layout fix#2
iPycc with Copilot wants to merge 2 commits into
mainfrom
copilot/refactor-front-end-project-structure

Conversation

Copilot AI commented Mar 23, 2026

Copy link
Copy Markdown

Project structure was monolithic with types/data/state mixed together, hardcoded style values scattered across components, and mobile layout overly cramped due to compounding padding/margins.

Type extraction

  • Extracted all TypeScript interfaces from mock-data.ts into src/lib/types.ts, organized by domain (auth, buckets, files, shares)
  • mock-data.ts re-exports for backward compatibility — zero import changes needed elsewhere

Design tokens (src/styles/design-tokens.css)

  • Centralized --radius-*, --font-sans, and responsive --spacing-* variables
  • Responsive spacing uses CSS custom properties with media query breakpoints (6px mobile → 16px desktop)
/* MainLayout now uses token-based spacing instead of hardcoded values */
<main className="flex ... gap-[var(--spacing-gap)] px-[var(--spacing-page-x)] pb-[var(--spacing-page-y)]">

API service layer (src/services/api.ts)

  • Interface definitions for AuthApi, UserApi, BucketApi, FileApi, ShareApi, OfflineTaskApi
  • Typed contracts ready for real backend swap — current mock state implementation unchanged

Mobile layout

  • MainLayout: replaced px-2 pb-3 gap-2 with CSS variable-based spacing
  • FileAreaLayout: p-5p-2.5 md:p-5
  • Toolbar: px-2px-1.5 md:px-2
  • NavbarLayout: px-4 p-3px-2 py-2 md:px-4 md:py-3

Style consistency

  • Replaced hardcoded hex colors in NavbarLayout (#666666, #2b2b2b, etc.) with theme variables (text-muted-foreground, hover:bg-card)
  • Unified font stack: Noto Sans SC + Geist Variable + Inter consolidated into single --font-sans variable

Mobile layout (375px)

mobile-layout

Original prompt

现有前端项目组建杂乱,请你重构整个前端项目,在不该动原有的代码的情况下,请你按照用需求模块进行组建,命名拆分多个大文件为小模块方便,后续维护统一字体,圆角等样式符合大厂规范 书写规范的移动端布局,目前极端布局非常狭窄,各种外边距那边距已经占住了原有的大小,请你重新给我重构,整个前端项目文件不要改变原来的代码风格结构拆分多个细致模块,方便后续对接真实后端API


⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.

… fix mobile layout

- Extract all TypeScript types from mock-data.ts into dedicated lib/types.ts
- Create unified design tokens in styles/design-tokens.css (radius, font, spacing)
- Create API service layer interfaces in services/api.ts for future backend integration
- Fix mobile layout: reduce excessive padding/margins in MainLayout, NavbarLayout,
  FileAreaLayout, and Toolbar to maximize content area on narrow screens
- Replace hardcoded hex colors in NavbarLayout with theme CSS variables
- Unify font configuration: consolidate Noto Sans SC + Geist + Inter into
  single font-sans variable via design tokens

Co-authored-by: iPycc <110518724+iPycc@users.noreply.github.com>
Agent-Logs-Url: https://github.com/iPycc/Cloudrave-Frontend/sessions/c39af1b8-5c66-441f-bb28-0e2d077bbeeb
Copilot AI changed the title [WIP] Refactor front-end project for better modularization refactor: modular type extraction, design tokens, API layer, mobile layout fix Mar 23, 2026
Copilot AI requested a review from iPycc March 23, 2026 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants