refactor: centralize theme/config/utils + fix data and console bugs
Phase 1 of the cohesion refactor (behavior-preserving): Single source of truth: - New src/lib/theme.ts: category colors (moved from data.ts, re-exported for back-compat), derived hex strings, nebula palette, UI colors, CSS var map - New src/lib/config.ts: breakpoint, zoom, parallax, node radii, particle counts, animation timings (previously scattered magic numbers) - New src/lib/utils/tree.ts: getNodeById, getNodeRadius, getDistanceFromOrigin, getBeamIntensity (pure helpers lifted out of onMount) - New src/lib/utils/stats.ts: branch ids/labels, proficiency order, and the stats-panel aggregation helpers (deduped from inline copies) - SkillTree.svelte now imports all of the above; removed the duplicated getCategoryColorHex, stats helpers, branch id/label lists, and inline magic numbers - Populated src/lib/index.ts barrel Bug fixes: - data.ts: tmdbAPI pypiUrl pointed at tvdbAPI -> corrected to tmdbAPI - Removed/ gated stray console.log noise (skill-tree-loaded, SW logs) - Removed dead vars (maxAlpha, glowMaxAlpha) and unused catch binding Tooling: ESLint + Prettier now clean; added Vitest unit tests for the new pure utils (14 tests). svelte-check: 0 errors. build: ok. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
aa58425f1a
commit
6c652e7138
12 files changed
+491
-219
No files matched your search
+4
-9
@@ -300,7 +300,7 @@ export const treeNodes: TreeNode[] = [
|
||||
icon: '/icons/python.svg',
|
||||
techStack: ['Python', 'REST API', 'PyPI', 'GitHub Actions', 'Unit Testing'],
|
||||
repoUrl: 'https://github.com/TehRiehlDeal/tmdbAPI',
|
||||
pypiUrl: 'https://pypi.org/project/tvdbAPI/',
|
||||
pypiUrl: 'https://pypi.org/project/tmdbAPI/',
|
||||
status: 'maintained'
|
||||
},
|
||||
{
|
||||
@@ -895,11 +895,6 @@ export const treeNodes: TreeNode[] = [
|
||||
// },
|
||||
];
|
||||
|
||||
// Colors for each category (PoE-inspired)
|
||||
export const categoryColors: Record<TreeNode['category'], number> = {
|
||||
origin: 0xffd700, // Gold
|
||||
experience: 0x4ecdc4, // Teal
|
||||
projects: 0xff6b6b, // Coral red
|
||||
skills: 0xf9a825, // Amber orange
|
||||
education: 0xdda0dd // Plum purple
|
||||
};
|
||||
// Category colours now live in `$lib/theme` (single source of truth).
|
||||
// Re-exported here for back-compat with existing `$lib/data` imports.
|
||||
export { categoryColors } from './theme';
|
||||
Reference in new issue
Block a user