Files
VoiceStudio/frontend/src/utils/voiceIcons.js
T
5c9b7ca313 chore(format): adopt oxfmt for JS/TS/JSX + CI format gate (#774)
Adds oxfmt (Rust formatter, Prettier-conformant) — the repo had no formatter, so
this is a one-time normalization of the JS/TS/JSX code (257 files; purely
cosmetic — full suite stays 638/638).

Scope is deliberately narrowed in .oxfmtrc.json to JS/TS/JSX only:
- singleQuote:true + jsxSingleQuote:false — preserve the project's existing
  style (single-quoted JS, double-quoted JSX attrs), not oxfmt's double-quote
  default. (Flipping quotes globally also broke a source-string-parsing test;
  preserving them keeps featureCoverage green.)
- Excludes **/*.css (the CSS→Tailwind migration will rewrite those — formatting
  them now is wasted churn), **/*.json (avoids reformatting 20 i18n locale
  files + config), **/*.toml, and src-tauri/** (Rust/Tauri config — out of scope
  for a frontend JS formatter; oxfmt was reformatting Cargo.toml/tauri.conf.json).

Tooling:
- `bun run format` (write) / `bun run format:check` (verify).
- ci.yml: new "Frontend format check (oxfmt)" gate after the oxlint gate.

Verified: format:check clean; oxlint 0 errors; vite build; full suite 638/638;
bun install --frozen-lockfile in sync.

Co-authored-by: mergetest <test@local>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-30 15:18:01 +05:30

70 lines
1.7 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* voiceIcons — lucide icon maps for the design tab's preset / personality
* chips and the demo-preset grid, replacing the old emoji glyphs. Keyed by the
* stable backend/constants id so labels stay in i18n and only the glyph swaps.
*/
import {
Megaphone,
Baby,
Wind,
PartyPopper,
BookOpen,
Flame,
Smile,
Tv,
Wand2,
Briefcase,
Zap,
Headphones,
Skull,
Mic,
Moon,
Sparkles,
UserSquare2,
} from 'lucide-react';
// PRESETS (utils/constants.js) — quick design starting points.
export const PRESET_ICONS = {
narrator: Megaphone, // "Authoritative"
excited_child: Baby,
anxious_whisper: Wind,
surprised_woman: PartyPopper,
elderly_story: BookOpen,
sichuan: Flame,
};
// Personality presets (backend personalities.py, is_demo=false) — chip strip.
export const PERSONALITY_ICONS = {
narrator: BookOpen,
casual: Smile,
news_anchor: Tv,
storyteller: Wand2,
corporate: Briefcase,
energetic: Zap,
};
// Demo presets (backend personalities.py, is_demo=true) — empty-state cards.
export const DEMO_ICONS = {
audiobook_uk_narrator: BookOpen,
us_news_anchor: Tv,
indian_support_agent: Headphones,
gravelly_villain: Skull,
aussie_podcaster: Mic,
bedtime_storyteller: Moon,
mandarin_sichuan: Flame,
};
export const FALLBACK_VOICE_ICON = Sparkles;
export const FALLBACK_PERSONALITY_ICON = UserSquare2;
/**
* Strip emoji/pictographs from an i18n label (CJK text passes through),
* collapsing the leftover whitespace. Lets us drop emoji from any locale's
* string without editing every locale file — the lucide icon renders instead.
*/
export const stripVoiceEmoji = (s) =>
(s || '')
.replace(/[\p{Extended_Pictographic}️‍]/gu, '')
.replace(/\s+/g, ' ')
.trim();