diff --git a/src/types.ts b/src/types.ts new file mode 100644 index 0000000..39aa308 --- /dev/null +++ b/src/types.ts @@ -0,0 +1,88 @@ +export interface Channel { + id: string; + name: string; + description: string; + gradient: string; + emoji: string; + categories: string[]; + subscriberCount: number; + videoCount: number; +} + +export interface Playlist { + id: string; + channelId: string; + title: string; + description: string; + videoCount: number; + gradient: string; + emoji: string; + categories: string[]; +} + +export interface Video { + id: string; + playlistId: string; + channelId: string; + title: string; + description: string; + duration: string; + durationSeconds: number; + viewCount: number; + publishedAt: string; + position: number; +} + +export interface Folder { + id: string; + name: string; + color: string; + emoji: string; + channelIds: string[]; +} + +export interface UserProgress { + watchedVideos: string[]; + playlistProgress: Record; + completedPlaylists: string[]; + streak: number; + lastWatchDate: string; + totalWatched: number; +} + +export type ViewType = + | { type: 'dashboard' } + | { type: 'channel'; channelId: string } + | { type: 'playlist'; playlistId: string } + | { type: 'browser' } + | { type: 'folder'; folderId: string } + | { type: 'video'; videoId: string; playlistId?: string }; + +export const CONTENT_FILTER = { + blockedKeywords: [ + 'sex', 'porn', 'nude', 'xxx', 'adult', 'erotic', 'nsfw', + 'مخلة', 'جنس', 'إباحي', 'عارية', 'عري', 'خمر', 'مخدرات', + 'قمار', 'رذيلة', 'فاحش', 'عاهرة', 'لواط', 'سحاق', + 'elusive', 'twilight', 'vampire' + ], + allowedCategories: [ + 'تعليم', 'تقنية', 'برمجة', 'علوم', 'دين', 'إسلام', 'تاريخ', + 'اختراعات', 'تصميم', 'مشاريع', 'ريادة', 'أعمال', 'شريعة', + 'لغة عربية', 'ثقافة', 'سياسة', 'حروب', 'فقه', 'عقيدة', + 'تفسير', 'حديث', 'سيرة', 'قرآن', 'ذكاء اصطناعي', 'هندسة', + 'عمارة', 'فيزياء', 'كيمياء', 'رياضيات', 'طب', 'فلك', + 'ابتكار', 'شعر', 'نثر', 'أناشيد', 'أدب', 'بلاغة', 'نحو', + 'صرف', 'حضارة', 'تراث', 'فن إسلامي', 'خط عربي', + 'روبوتات', 'إلكترونيات', 'طاقة', 'بيئة', 'زراعة', + 'إدارة', 'تسويق', 'اقتصاد', 'محاسبة', 'قانون', + 'عسكرية', 'استراتيجية', 'جغرافيا', 'آثار' + ] +}; + +export function isContentAllowed(title: string, _categories: string[]): boolean { + const lowerTitle = title.toLowerCase(); + for (const keyword of CONTENT_FILTER.blockedKeywords) { + if (lowerTitle.includes(keyword.toLowerCase())) return false; + } + return true; +}