refactor: migrate project to TypeScript and translate comments to English
Build & Deploy (develop) / build-and-deploy (push) Successful in 2m23s

This commit is contained in:
2026-09-14 13:27:17 +02:00
parent 1ef621f832
commit 4cd34106b0
35 changed files with 427 additions and 165 deletions
@@ -1,13 +1,23 @@
'use client';
import type {Dispatch, SetStateAction, ReactNode} from 'react';
import type {Locale, SiteContent, Direction} from '@/types/domain';
import {createContext, useContext, useEffect, useState} from 'react';
import {content} from '@/data/content';
const LanguageContext = createContext(null);
interface LanguageContextValue {
locale: Locale;
setLocale: Dispatch<SetStateAction<Locale>>;
toggleLocale: () => void;
t: SiteContent;
dir: Direction;
mounted: boolean;
}
export function LanguageProvider({children}) {
const [locale, setLocale] = useState('fa');
const LanguageContext = createContext<LanguageContextValue | null>(null);
export function LanguageProvider({children}: {children: ReactNode}) {
const [locale, setLocale] = useState<Locale>('fa');
const [mounted, setMounted] = useState(false);
useEffect(() => {
@@ -1,12 +1,21 @@
'use client';
import type {Dispatch, SetStateAction, ReactNode} from 'react';
import type {Theme} from '@/types/domain';
import {createContext, useContext, useEffect, useState} from 'react';
const ThemeContext = createContext(null);
interface ThemeContextValue {
theme: Theme;
setTheme: Dispatch<SetStateAction<Theme>>;
toggleTheme: () => void;
mounted: boolean;
}
export function ThemeProvider({children}) {
const ThemeContext = createContext<ThemeContextValue | null>(null);
const [theme, setTheme] = useState('light');
export function ThemeProvider({children}: {children: ReactNode}) {
const [theme, setTheme] = useState<Theme>('light');
const [mounted, setMounted] = useState(false);
@@ -42,4 +51,3 @@ export function useTheme() {
if (!ctx) throw new Error('useTheme must be used within ThemeProvider');
return ctx;
}