diff --git a/src/app/page.tsx b/src/app/page.tsx index 24905a9..0d2244f 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -6,6 +6,7 @@ import { FormEvent, useEffect, useMemo, useRef, useState } from "react"; import type { DashboardGridProps } from "@/components/DashboardGrid"; import type { DashboardGridWidget, DashboardLayoutItem } from "@/lib/dashboard-layout"; import { sortLayoutForPosition } from "@/lib/dashboard-layout"; +import type { User, Settings, DashboardTab, WidgetType, Widget, SearchProvider, CalendarEvent, CalendarSource, CalendarWidgetCalendarConfig, NoteBoardItem } from "@/types/dashboard"; import CalculatorWidget from "@/components/CalculatorWidget"; import CalendarWidget from "@/components/CalendarWidget"; import ClockWidget from "@/components/ClockWidget"; @@ -25,95 +26,6 @@ const DashboardGrid = dynamic(() => import("@/components/Das ) }); -type User = { - id: string; - email: string; - displayName: string | null; - role: "ADMIN" | "USER"; -}; - -type Settings = { - id: string; - userId: string; - darkMode: boolean; - calendarIcsUrl: string | null; - calendarMaxEvents: number; - calendarLookaheadDays: number; - dashboardTitle: string; - dashboardSubtitle: string | null; - logoUrl: string | null; - backgroundImageUrl: string | null; - backgroundImageOpacity: number; - primaryColor: string; - secondaryColor: string; - customCss: string; -}; - -type DashboardTab = { - id: string; - userId: string; - title: string; - position: number; -}; - -type WidgetType = "favorites" | "note" | "search" | "calendar" | "calculator" | "clock" | "domain-check"; - -type Widget = DashboardGridWidget & { - userId: string; - viewMode?: string; -}; - -type SearchProvider = { - id: string; - label: string; - urlTemplate: string; -}; - -type CalendarEvent = { - id: string; - title: string; - start: string; - end: string | null; - location: string | null; -}; - -type CalendarSourceType = "ICS" | "EXCHANGE_EWS"; - -type CalendarSource = { - id: string; - userId: string; - type: CalendarSourceType; - name: string; - color: string; - nextEventsCount: number; - icsUrl: string | null; - exchangeEwsUrl: string | null; - exchangeMailbox: string | null; - exchangeUsername: string | null; - exchangeDomain: string | null; - passwordConfigured: boolean; -}; - -type CalendarWidgetCalendarConfig = { - sources: CalendarSource[]; - selectedSourceIds: string[]; - nextEventsCount: number; -}; - -type NoteBoardItem = { - id: string; - userId: string; - type: "note" | string; - title: string; - content: string; - x: number; - y: number; - w: number; - h: number; - createdAt: string; - updatedAt: string; -}; - const searchProviders: SearchProvider[] = [ { id: "google", diff --git a/src/app/settings/page.tsx b/src/app/settings/page.tsx index dcd0500..236450b 100644 --- a/src/app/settings/page.tsx +++ b/src/app/settings/page.tsx @@ -1,41 +1,7 @@ "use client"; import { FormEvent, useEffect, useState } from "react"; - -type Settings = { - id: string; - userId: string; - darkMode: boolean; - calendarIcsUrl: string | null; - calendarMaxEvents: number; - calendarLookaheadDays: number; - dashboardTitle: string; - dashboardSubtitle: string | null; - logoUrl: string | null; - faviconUrl: string | null; - backgroundImageUrl: string | null; - backgroundImageOpacity: number; - primaryColor: string; - secondaryColor: string; - customCss: string; -}; - -type CalendarSourceType = "ICS" | "EXCHANGE_EWS"; - -type CalendarSource = { - id: string; - userId: string; - type: CalendarSourceType; - name: string; - color: string; - nextEventsCount: number; - icsUrl: string | null; - exchangeEwsUrl: string | null; - exchangeMailbox: string | null; - exchangeUsername: string | null; - exchangeDomain: string | null; - passwordConfigured: boolean; -}; +import type { Settings, CalendarSource, CalendarSourceType } from "@/types/dashboard"; type CalendarSourceDraft = { sourceId: string | null; diff --git a/src/components/CalendarWidget.tsx b/src/components/CalendarWidget.tsx index c005d01..6ce8cf1 100644 --- a/src/components/CalendarWidget.tsx +++ b/src/components/CalendarWidget.tsx @@ -1,22 +1,7 @@ "use client"; import { useMemo, useState } from "react"; - -type CalendarEvent = { - id: string; - title: string; - start: string; - end: string | null; - location: string | null; -}; - -type CalendarSource = { - id: string; - name: string; - color: string; - type: string; - passwordConfigured: boolean; -}; +import type { CalendarEvent, CalendarSource } from "@/types/dashboard"; type CalendarWidgetProps = { widgetId: string; diff --git a/src/components/NoteWidget.tsx b/src/components/NoteWidget.tsx index 294e2ee..0059684 100644 --- a/src/components/NoteWidget.tsx +++ b/src/components/NoteWidget.tsx @@ -2,20 +2,7 @@ import type { ReactNode } from "react"; import { useState } from "react"; - -type NoteBoardItem = { - id: string; - userId: string; - type: "note" | string; - title: string; - content: string; - x: number; - y: number; - w: number; - h: number; - createdAt: string; - updatedAt: string; -}; +import type { NoteBoardItem } from "@/types/dashboard"; type NoteWidgetProps = { note: NoteBoardItem | null; diff --git a/src/types/dashboard.ts b/src/types/dashboard.ts new file mode 100644 index 0000000..c75245d --- /dev/null +++ b/src/types/dashboard.ts @@ -0,0 +1,91 @@ +import type { DashboardGridWidget } from "@/lib/dashboard-layout"; + +export type User = { + id: string; + email: string; + displayName: string | null; + role: "ADMIN" | "USER"; +}; + +export type Settings = { + id: string; + userId: string; + darkMode: boolean; + calendarIcsUrl: string | null; + calendarMaxEvents: number; + calendarLookaheadDays: number; + dashboardTitle: string; + dashboardSubtitle: string | null; + logoUrl: string | null; + faviconUrl: string | null; + backgroundImageUrl: string | null; + backgroundImageOpacity: number; + primaryColor: string; + secondaryColor: string; + customCss: string; +}; + +export type DashboardTab = { + id: string; + userId: string; + title: string; + position: number; +}; + +export type WidgetType = "favorites" | "note" | "search" | "calendar" | "calculator" | "clock" | "domain-check"; + +export type Widget = DashboardGridWidget & { + userId: string; + viewMode?: string; +}; + +export type SearchProvider = { + id: string; + label: string; + urlTemplate: string; +}; + +export type CalendarEvent = { + id: string; + title: string; + start: string; + end: string | null; + location: string | null; +}; + +export type CalendarSourceType = "ICS" | "EXCHANGE_EWS"; + +export type CalendarSource = { + id: string; + userId: string; + type: CalendarSourceType; + name: string; + color: string; + nextEventsCount: number; + icsUrl: string | null; + exchangeEwsUrl: string | null; + exchangeMailbox: string | null; + exchangeUsername: string | null; + exchangeDomain: string | null; + passwordConfigured: boolean; +}; + +export type CalendarWidgetCalendarConfig = { + sources: CalendarSource[]; + selectedSourceIds: string[]; + nextEventsCount: number; +}; + +export type NoteBoardItem = { + id: string; + userId: string; + type: "note" | string; + title: string; + content: string; + x: number; + y: number; + w: number; + h: number; + createdAt: string; + updatedAt: string; +};