Skip to content

feat: add official website with bilingual support#7

Merged
Scofieldfree merged 8 commits intomainfrom
feature/website
Jan 26, 2026
Merged

feat: add official website with bilingual support#7
Scofieldfree merged 8 commits intomainfrom
feature/website

Conversation

@Scofieldfree
Copy link
Contributor

Summary

Add a modern, responsive official website for Voice Key with bilingual English/Chinese support.

Features

  • Bilingual Support: Full EN/ZH translations with language switcher
  • Modern Design: Geek-style aesthetic with grid patterns and tech-inspired UI
  • Theme Toggle: Light/dark mode switching with localStorage persistence
  • Responsive: Mobile-first design that works on all devices
  • Deployment: GitHub Actions workflow for automatic deployment to GitHub Pages

Tech Stack

  • Framework: Astro 5
  • Styling: Tailwind CSS 4
  • Icons: lucide-react
  • Deployment: GitHub Pages via GitHub Actions

Website Structure

website/
├── src/
│   ├── components/
│   │   ├── LanguageSwitch.astro
│   │   └── ThemeToggle.astro
│   ├── layouts/
│   │   └── BaseLayout.astro
│   ├── pages/
│   │   ├── index.astro (English)
│   │   └── zh/
│   │       └── index.astro (Chinese)
│   ├── assets/
│   │   └── logo.png
│   └── styles/
│       └── global.css
├── public/
└── astro.config.mjs

CI/CD Changes

  • Added .github/workflows/deploy-website.yml for automatic deployment
  • Excluded website/ from root project CI/linting (independent subproject)
  • Updated .prettierignore and eslint.config.mjs

Preview

Website will be deployed to: https://buildwithais.github.io/voicekey/

Testing

  • English page renders correctly
  • Chinese page renders correctly
  • Language switcher works
  • Theme toggle works
  • Responsive design on mobile/tablet/desktop
  • GitHub Actions workflow configured

🤖 Generated with Claude Code

Initialize new Astro-based website in website/ directory for the
official project website. Adds npm scripts for website development
and updates .gitignore to exclude website dependencies and build
artifacts.
Add comprehensive Chinese translation with language switcher component.
Integrate lucide-react icons for consistent iconography. Add GitHub
Actions workflow for automatic deployment to GitHub Pages. Update UI
with shadcn-style theming and improved responsive design.

Features:
- Bilingual EN/ZH pages with LanguageSwitch component
- GitHub Actions deploy workflow for website/ directory
- Enhanced UI with lucide-react icons
- Improved theming with shadcn-style design tokens
- Logo asset integration
Remove privacy policy and terms of service links from both English
and Chinese pages as these pages are not yet implemented.
Complete UI overhaul with modern technical/developer-focused design
featuring grid patterns, corner accents, and monospace typography.

Highlights:
- Grid pattern background with radial gradient masking
- Version badge with animated ping indicator
- Feature data arrays for cleaner component structure
- Corner accent decorations on feature cards
- Geek-style buttons with rounded-md and font-mono
- Enhanced hover effects with scale and glow transitions
- Minimalist footer with status indicator
- Improved text spacing and leading for readability
- OS support badges with Command/Monitor icons
Add client-side theme switching with localStorage persistence.
Theme preference is initialized inline to prevent flash of unstyled
content (FOUC). Toggle component positioned in top-right controls
alongside language switcher.

Features:
- ThemeToggle component with Sun/Moon icons
- Inline theme initialization script in BaseLayout
- localStorage persistence for theme preference
- System preference detection (prefers-color-scheme)
- Responsive positioning with flexbox layout
- Smooth transitions between themes
- Default to dark mode
Exclude website directory from root project ESLint, Prettier, and
GitHub Actions CI since it's an independent subproject with its
own configuration and tooling.

Changes:
- Add paths-ignore to CI workflow for website, markdown, and images
- Add website/ and temp-docs/ to .prettierignore
- Add website/ and temp-docs/ to ESLint ignores
@Scofieldfree
Copy link
Contributor Author


Code review

Found 1 issue:

  1. Missing localStorage error handling can crash theme initialization in private browsing mode (CLAUDE.md says "Only validate at system boundaries" - localStorage is a browser API that can throw SecurityError/QuotaExceededError)

const getTheme = () => {
if (typeof localStorage !== 'undefined' && localStorage.getItem('theme')) {
return localStorage.getItem('theme');
}
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
return 'dark';
}
return 'dark'; // 默认暗色
};
const theme = getTheme();
document.documentElement.classList.toggle('dark', theme === 'dark');
window.localStorage.setItem('theme', theme);
})();

The script accesses localStorage without try-catch protection. In Safari private browsing, Firefox strict privacy mode, or when storage quota is exceeded, localStorage exists but throws errors when getItem or setItem is called. This will crash the entire theme initialization script, leaving the page unstyled.

Recommend wrapping localStorage operations in try-catch:

const getTheme = () => {
  try {
    if (typeof localStorage !== 'undefined') {
      const stored = localStorage.getItem('theme');
      if (stored) return stored;
    }
  } catch (e) {
    // Silently fail - localStorage unavailable
  }
  // Fallback to system preference or default
  return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
};

const theme = getTheme();
document.documentElement.classList.toggle('dark', theme === 'dark');
try {
  if (typeof localStorage !== 'undefined') {
    localStorage.setItem('theme', theme);
  }
} catch (e) {
  // Silently fail
}

This pattern follows the same defensive approach used for navigator.language fallback in commit 0ee7adc (src/i18n.ts).

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

Fix typo in site URL from buildwithaIs to BuildWithAIs (matching
GitHub organization name). Add missing setup-pages action in
GitHub workflow for proper GitHub Pages deployment configuration.

Changes:
- Correct site URL to use proper capitalization
- Add actions/configure-pages@v5 step before build
- Ensure proper GitHub Pages configuration
Wrap localStorage operations in try-catch to prevent crashes in
private browsing mode or when storage quota is exceeded. Follows
the same defensive pattern used for i18n fallback (commit 0ee7adc).

Changes:
- Add try-catch around localStorage.getItem in BaseLayout
- Add try-catch around localStorage.setItem in both files
- Gracefully handle SecurityError and QuotaExceededError
- Prevents theme initialization from crashing in restricted modes
@Scofieldfree Scofieldfree merged commit 0cf6dfc into main Jan 26, 2026
2 checks passed
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.

1 participant