From 6de6c7fd95de1de9d8d3107eaf7ce1dd150ed094 Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Tue, 14 Apr 2026 18:17:14 +0200 Subject: refactor: move constants to domain modules --- apps/web/src/components/editor/editor-header.tsx | 3 ++- apps/web/src/components/editor/export-button.tsx | 2 +- apps/web/src/components/editor/onboarding.tsx | 2 +- apps/web/src/components/editor/panels/assets/views/captions.tsx | 4 ++-- .../components/editor/panels/assets/views/settings/background.tsx | 4 ++-- .../src/components/editor/panels/assets/views/settings/index.tsx | 2 +- apps/web/src/components/editor/panels/assets/views/stickers.tsx | 2 +- apps/web/src/components/editor/panels/preview/preview-viewport.tsx | 2 +- apps/web/src/components/editor/panels/preview/text-edit-overlay.tsx | 2 +- apps/web/src/components/editor/panels/preview/toolbar.tsx | 2 +- apps/web/src/components/editor/panels/properties/tabs/text-tab.tsx | 6 ++++-- apps/web/src/components/editor/panels/timeline/bookmarks.tsx | 2 +- apps/web/src/components/editor/panels/timeline/timeline-ruler.tsx | 2 +- 13 files changed, 19 insertions(+), 16 deletions(-) (limited to 'apps/web/src/components/editor') diff --git a/apps/web/src/components/editor/editor-header.tsx b/apps/web/src/components/editor/editor-header.tsx index 460e8ed6..ddfcaad4 100644 --- a/apps/web/src/components/editor/editor-header.tsx +++ b/apps/web/src/components/editor/editor-header.tsx @@ -16,7 +16,8 @@ import { useRouter } from "next/navigation"; import { FaDiscord } from "react-icons/fa6"; import { ExportButton } from "./export-button"; import { ThemeToggle } from "../theme-toggle"; -import { DEFAULT_LOGO_URL, SOCIAL_LINKS } from "@/constants/site-constants"; +import { DEFAULT_LOGO_URL } from "@/lib/site/brand"; +import { SOCIAL_LINKS } from "@/lib/site/social"; import { toast } from "sonner"; import { useEditor } from "@/hooks/use-editor"; import { CommandIcon, Logout05Icon } from "@hugeicons/core-free-icons"; diff --git a/apps/web/src/components/editor/export-button.tsx b/apps/web/src/components/editor/export-button.tsx index 3fa4af7a..1f907953 100644 --- a/apps/web/src/components/editor/export-button.tsx +++ b/apps/web/src/components/editor/export-button.tsx @@ -33,7 +33,7 @@ import { SectionTitle, } from "@/components/section"; import { useEditor } from "@/hooks/use-editor"; -import { DEFAULT_EXPORT_OPTIONS } from "@/constants/export-constants"; +import { DEFAULT_EXPORT_OPTIONS } from "@/lib/export/defaults"; function isExportFormat(value: string): value is ExportFormat { return EXPORT_FORMAT_VALUES.some((formatValue) => formatValue === value); diff --git a/apps/web/src/components/editor/onboarding.tsx b/apps/web/src/components/editor/onboarding.tsx index 12bddc8e..54196c76 100644 --- a/apps/web/src/components/editor/onboarding.tsx +++ b/apps/web/src/components/editor/onboarding.tsx @@ -3,7 +3,7 @@ import { ArrowRightIcon } from "lucide-react"; import { useState } from "react"; import ReactMarkdown from "react-markdown"; -import { SOCIAL_LINKS } from "@/constants/site-constants"; +import { SOCIAL_LINKS } from "@/lib/site/social"; import { useLocalStorage } from "@/hooks/storage/use-local-storage"; import { Button } from "../ui/button"; import { Dialog, DialogBody, DialogContent, DialogTitle } from "../ui/dialog"; diff --git a/apps/web/src/components/editor/panels/assets/views/captions.tsx b/apps/web/src/components/editor/panels/assets/views/captions.tsx index 488875a8..7b6ae5ca 100644 --- a/apps/web/src/components/editor/panels/assets/views/captions.tsx +++ b/apps/web/src/components/editor/panels/assets/views/captions.tsx @@ -12,8 +12,8 @@ import { extractTimelineAudio } from "@/lib/media/mediabunny"; import { useEditor } from "@/hooks/use-editor"; import { DEFAULT_TRANSCRIPTION_SAMPLE_RATE, - TRANSCRIPTION_LANGUAGES, -} from "@/constants/transcription-constants"; +} from "@/lib/transcription/audio"; +import { TRANSCRIPTION_LANGUAGES } from "@/lib/transcription/supported-languages"; import type { CaptionChunk, TranscriptionLanguage, diff --git a/apps/web/src/components/editor/panels/assets/views/settings/background.tsx b/apps/web/src/components/editor/panels/assets/views/settings/background.tsx index 72883e35..0367559a 100644 --- a/apps/web/src/components/editor/panels/assets/views/settings/background.tsx +++ b/apps/web/src/components/editor/panels/assets/views/settings/background.tsx @@ -10,8 +10,8 @@ import { import { BACKGROUND_BLUR_INTENSITY_PRESETS, DEFAULT_BACKGROUND_BLUR_INTENSITY, - DEFAULT_BACKGROUND_COLOR, -} from "@/lib/background/constants"; +} from "@/lib/background/blur"; +import { DEFAULT_BACKGROUND_COLOR } from "@/lib/background/color"; import { patternCraftGradients } from "@/data/colors/pattern-craft"; import { colors } from "@/data/colors/solid"; import { syntaxUIGradients } from "@/data/colors/syntax-ui"; diff --git a/apps/web/src/components/editor/panels/assets/views/settings/index.tsx b/apps/web/src/components/editor/panels/assets/views/settings/index.tsx index 16faad3d..4d87493a 100644 --- a/apps/web/src/components/editor/panels/assets/views/settings/index.tsx +++ b/apps/web/src/components/editor/panels/assets/views/settings/index.tsx @@ -9,7 +9,7 @@ import { SelectTrigger, SelectValue, } from "@/components/ui/select"; -import { FPS_PRESETS } from "@/lib/fps/constants"; +import { FPS_PRESETS } from "@/lib/fps/presets"; import { floatToFrameRate, frameRateToFloat } from "@/lib/fps/utils"; import { useEditor } from "@/hooks/use-editor"; import { diff --git a/apps/web/src/components/editor/panels/assets/views/stickers.tsx b/apps/web/src/components/editor/panels/assets/views/stickers.tsx index 5b076466..1ab35d7d 100644 --- a/apps/web/src/components/editor/panels/assets/views/stickers.tsx +++ b/apps/web/src/components/editor/panels/assets/views/stickers.tsx @@ -15,7 +15,7 @@ import { buildGraphicElement, buildStickerElement, } from "@/lib/timeline/element-utils"; -import { STICKER_CATEGORIES } from "@/constants/sticker-constants"; +import { STICKER_CATEGORIES } from "@/lib/stickers/categories"; import { getRegionLabel, resolveQueryToRegions } from "@/lib/stickers"; import { parseShapeStickerId } from "@/lib/stickers/providers/shapes"; import type { TimelineDragData } from "@/lib/timeline/drag"; diff --git a/apps/web/src/components/editor/panels/preview/preview-viewport.tsx b/apps/web/src/components/editor/panels/preview/preview-viewport.tsx index 51e5d2d0..2ac6bd92 100644 --- a/apps/web/src/components/editor/panels/preview/preview-viewport.tsx +++ b/apps/web/src/components/editor/panels/preview/preview-viewport.tsx @@ -17,7 +17,7 @@ import { screenToCanvas, } from "@/lib/preview/preview-coords"; import { clamp, isNearlyEqual } from "@/utils/math"; -import { PREVIEW_ZOOM } from "@/lib/preview/constants"; +import { PREVIEW_ZOOM } from "@/lib/preview/zoom"; const MIDDLE_MOUSE_BUTTON = 1; const IS_AT_FIT_EPSILON = 0.001; diff --git a/apps/web/src/components/editor/panels/preview/text-edit-overlay.tsx b/apps/web/src/components/editor/panels/preview/text-edit-overlay.tsx index 78114b27..44281ade 100644 --- a/apps/web/src/components/editor/panels/preview/text-edit-overlay.tsx +++ b/apps/web/src/components/editor/panels/preview/text-edit-overlay.tsx @@ -6,7 +6,7 @@ import { useEditor } from "@/hooks/use-editor"; import type { TextElement } from "@/lib/timeline"; import { FONT_SIZE_SCALE_REFERENCE, -} from "@/constants/text-constants"; +} from "@/lib/text/typography"; import { DEFAULTS } from "@/lib/timeline/defaults"; import { getElementLocalTime, diff --git a/apps/web/src/components/editor/panels/preview/toolbar.tsx b/apps/web/src/components/editor/panels/preview/toolbar.tsx index c417ec6a..9ee6c822 100644 --- a/apps/web/src/components/editor/panels/preview/toolbar.tsx +++ b/apps/web/src/components/editor/panels/preview/toolbar.tsx @@ -22,7 +22,7 @@ import { SelectItem, SelectSeparator, } from "@/components/ui/select"; -import { PREVIEW_ZOOM_PRESETS } from "@/lib/preview/constants"; +import { PREVIEW_ZOOM_PRESETS } from "@/lib/preview/zoom"; import { usePreviewViewport } from "./preview-viewport"; import { GridPopover } from "./guide-popover"; import { usePreviewStore } from "@/stores/preview-store"; diff --git a/apps/web/src/components/editor/panels/properties/tabs/text-tab.tsx b/apps/web/src/components/editor/panels/properties/tabs/text-tab.tsx index 5fffbcec..d37379ea 100644 --- a/apps/web/src/components/editor/panels/properties/tabs/text-tab.tsx +++ b/apps/web/src/components/editor/panels/properties/tabs/text-tab.tsx @@ -20,11 +20,13 @@ import { clamp, formatNumberForDisplay } from "@/utils/math"; import { useEditor } from "@/hooks/use-editor"; import { CORNER_RADIUS_MAX, - DEFAULT_TEXT_COLOR, CORNER_RADIUS_MIN, +} from "@/lib/text/background"; +import { + DEFAULT_TEXT_COLOR, MAX_FONT_SIZE, MIN_FONT_SIZE, -} from "@/lib/text/constants"; +} from "@/lib/text/typography"; import { usePropertyDraft } from "../hooks/use-property-draft"; import { useKeyframedColorProperty } from "../hooks/use-keyframed-color-property"; import { useKeyframedNumberProperty } from "../hooks/use-keyframed-number-property"; diff --git a/apps/web/src/components/editor/panels/timeline/bookmarks.tsx b/apps/web/src/components/editor/panels/timeline/bookmarks.tsx index 9342c30e..c432b7d4 100644 --- a/apps/web/src/components/editor/panels/timeline/bookmarks.tsx +++ b/apps/web/src/components/editor/panels/timeline/bookmarks.tsx @@ -8,7 +8,7 @@ import { DEFAULT_TIMELINE_BOOKMARK_COLOR, } from "./theme"; import { TIMELINE_BOOKMARK_ROW_HEIGHT_PX } from "./layout"; -import { DEFAULT_FPS } from "@/lib/fps/constants"; +import { DEFAULT_FPS } from "@/lib/fps/defaults"; import { snappedSeekTime } from "opencut-wasm"; import { ArrowTurnBackwardIcon, diff --git a/apps/web/src/components/editor/panels/timeline/timeline-ruler.tsx b/apps/web/src/components/editor/panels/timeline/timeline-ruler.tsx index 8b8dab32..7b69e820 100644 --- a/apps/web/src/components/editor/panels/timeline/timeline-ruler.tsx +++ b/apps/web/src/components/editor/panels/timeline/timeline-ruler.tsx @@ -5,7 +5,7 @@ import { import { mediaTimeToSeconds } from "opencut-wasm"; import { TICKS_PER_SECOND } from "@/lib/wasm"; import { TIMELINE_RULER_HEIGHT_PX } from "./layout"; -import { DEFAULT_FPS } from "@/lib/fps/constants"; +import { DEFAULT_FPS } from "@/lib/fps/defaults"; import { useEditor } from "@/hooks/use-editor"; import { getRulerConfig, shouldShowLabel } from "@/lib/timeline/ruler-utils"; import { useScrollPosition } from "@/hooks/timeline/use-scroll-position"; -- cgit v1.3.1