Skip to content

Commit cf7a5ab

Browse files
committed
refactor: migrate to feature-based architecture
- Reorganize codebase from flat structure to feature-based modules - Move components, hooks, and utilities into feature-specific directories - Consolidate shared utilities and components in src/shared/ - Add Storybook configuration for component development - Update TypeScript configuration and Vite config for new structure - Remove deprecated utility scripts and documentation files - Clean up unused image compression scripts - Update dependencies in package.json and package-lock.json - Enhance service worker and sitemap generation - Improve build configuration with cleanup scripts Breaking changes: - Import paths have changed from flat structure to feature-based - Some components have been reorganized under src/features/ - Shared utilities moved from src/utils/ to src/shared/utils/ This refactoring improves code organization, maintainability, and scalability by grouping related functionality into cohesive feature modules.
1 parent 5d19cb9 commit cf7a5ab

149 files changed

Lines changed: 12815 additions & 5047 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,15 @@ lerna-debug.log*
5050

5151
# OS
5252
Thumbs.db
53+
54+
# Storybook
55+
*storybook.log
56+
storybook-static
57+
58+
# Temporary files
59+
depcheck-results.json
60+
compress-*.js
61+
compress-*.cjs
62+
63+
# WASM build artifacts
64+
wasm-modules/target/

.storybook/main.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import type { StorybookConfig } from '@storybook/react-vite';
2+
import { mergeConfig } from 'vite';
3+
4+
const config: StorybookConfig = {
5+
stories: [
6+
"../src/shared/ui/stories/**/*.mdx",
7+
"../src/shared/ui/stories/**/*.stories.@(js|jsx|ts|tsx)"
8+
],
9+
10+
addons: ["@storybook/addon-a11y", '@storybook/addon-docs'],
11+
12+
framework: {
13+
name: "@storybook/react-vite",
14+
options: {}
15+
},
16+
17+
core: {
18+
disableTelemetry: true,
19+
},
20+
21+
async viteFinal(config) {
22+
return mergeConfig(config, {
23+
resolve: {
24+
alias: {
25+
'@': '/src',
26+
'@/features': '/src/features',
27+
'@/shared': '/src/shared',
28+
},
29+
dedupe: ['react', 'react-dom', 'react/jsx-runtime']
30+
},
31+
optimizeDeps: {
32+
include: ['react', 'react-dom', 'react/jsx-runtime'],
33+
force: true
34+
}
35+
});
36+
}
37+
};
38+
39+
export default config;

.storybook/preview-head.html

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<!-- Load Google Fonts for proper typography -->
2+
<link rel="preconnect" href="https://fonts.googleapis.com">
3+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
4+
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Roboto:wght@300;400;500;700&family=Tajawal:wght@300;400;500;700&display=swap" rel="stylesheet">
5+
6+
<style>
7+
/* Ensure fonts are applied globally in Storybook */
8+
body {
9+
font-family: 'Roboto', 'SF Pro Text', 'Inter', sans-serif;
10+
-webkit-font-smoothing: antialiased;
11+
-moz-osx-font-smoothing: grayscale;
12+
}
13+
14+
h1, h2, h3, h4, h5, h6 {
15+
font-family: 'Poppins', 'SF Pro Display', 'Inter', sans-serif;
16+
}
17+
18+
/* Arabic font support */
19+
[dir="rtl"],
20+
[lang="ar"] {
21+
font-family: 'Tajawal', 'Roboto', sans-serif;
22+
}
23+
24+
[dir="rtl"] h1,
25+
[dir="rtl"] h2,
26+
[dir="rtl"] h3,
27+
[dir="rtl"] h4,
28+
[dir="rtl"] h5,
29+
[dir="rtl"] h6,
30+
[lang="ar"] h1,
31+
[lang="ar"] h2,
32+
[lang="ar"] h3,
33+
[lang="ar"] h4,
34+
[lang="ar"] h5,
35+
[lang="ar"] h6 {
36+
font-family: 'Tajawal', 'Poppins', sans-serif;
37+
}
38+
</style>

.storybook/preview.ts

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import type { Preview } from '@storybook/react-vite';
2+
3+
// Import our UI components styles
4+
import '../src/components/ui/ui-components.css';
5+
6+
// Import main application styles for proper theming and fonts
7+
import '../index.css';
8+
9+
const preview: Preview = {
10+
parameters: {
11+
layout: 'centered',
12+
controls: {
13+
matchers: {
14+
color: /(background|color)$/i,
15+
date: /Date$/i,
16+
},
17+
expanded: true,
18+
},
19+
docs: {
20+
toc: true,
21+
},
22+
a11y: {
23+
// 'todo' - show a11y violations in the test UI only
24+
// 'error' - fail CI on a11y violations
25+
// 'off' - skip a11y checks entirely
26+
test: 'todo',
27+
config: {
28+
rules: [
29+
{
30+
// This rule is disabled because we use aria-label correctly
31+
id: 'button-name',
32+
enabled: true,
33+
},
34+
],
35+
},
36+
},
37+
backgrounds: {
38+
options: {
39+
light: {
40+
name: 'light',
41+
value: '#ffffff',
42+
},
43+
44+
dark: {
45+
name: 'dark',
46+
value: '#1f2937',
47+
},
48+
49+
gray: {
50+
name: 'gray',
51+
value: '#f3f4f6',
52+
}
53+
}
54+
},
55+
},
56+
57+
globalTypes: {
58+
theme: {
59+
name: 'Theme',
60+
description: 'Global theme for components',
61+
defaultValue: 'light',
62+
toolbar: {
63+
icon: 'circlehollow',
64+
items: [
65+
{ value: 'light', icon: 'sun', title: 'Light' },
66+
{ value: 'dark', icon: 'moon', title: 'Dark' },
67+
],
68+
showName: true,
69+
dynamicTitle: true,
70+
},
71+
},
72+
},
73+
74+
initialGlobals: {
75+
backgrounds: {
76+
value: 'light'
77+
}
78+
}
79+
};
80+
81+
export default preview;

.storybook/vitest.setup.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import * as a11yAddonAnnotations from "@storybook/addon-a11y/preview";
2+
import { setProjectAnnotations } from '@storybook/react-vite';
3+
import * as projectAnnotations from './preview';
4+
5+
// This is an important step to apply the right configuration when testing your stories.
6+
// More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations
7+
setProjectAnnotations([a11yAddonAnnotations, projectAnnotations]);

0 commit comments

Comments
 (0)