mirror of
https://github.com/OpenCut-app/OpenCut.git
synced 2026-07-13 21:52:53 +02:00
chore: normalize line endings
This commit is contained in:
@@ -1,24 +1,24 @@
|
||||
import { PlusSignIcon, RulerIcon } from "@hugeicons/core-free-icons";
|
||||
import { HugeiconsIcon } from "@hugeicons/react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import type { GuideDefinition } from "@/lib/guides/types";
|
||||
|
||||
function CustomGuideOptions() {
|
||||
return (
|
||||
<div className="flex gap-2">
|
||||
<Button variant="outline" size="sm" className="flex-1">
|
||||
<HugeiconsIcon icon={PlusSignIcon} />
|
||||
Add guide line
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export const customGuide = {
|
||||
id: "custom",
|
||||
label: "Custom",
|
||||
renderPreview: () => <HugeiconsIcon size={16} icon={RulerIcon} />,
|
||||
renderTriggerIcon: () => <HugeiconsIcon icon={RulerIcon} />,
|
||||
renderOverlay: () => null,
|
||||
renderOptions: () => <CustomGuideOptions />,
|
||||
} as const satisfies GuideDefinition;
|
||||
import { PlusSignIcon, RulerIcon } from "@hugeicons/core-free-icons";
|
||||
import { HugeiconsIcon } from "@hugeicons/react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import type { GuideDefinition } from "@/lib/guides/types";
|
||||
|
||||
function CustomGuideOptions() {
|
||||
return (
|
||||
<div className="flex gap-2">
|
||||
<Button variant="outline" size="sm" className="flex-1">
|
||||
<HugeiconsIcon icon={PlusSignIcon} />
|
||||
Add guide line
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export const customGuide = {
|
||||
id: "custom",
|
||||
label: "Custom",
|
||||
renderPreview: () => <HugeiconsIcon size={16} icon={RulerIcon} />,
|
||||
renderTriggerIcon: () => <HugeiconsIcon icon={RulerIcon} />,
|
||||
renderOverlay: () => null,
|
||||
renderOptions: () => <CustomGuideOptions />,
|
||||
} as const satisfies GuideDefinition;
|
||||
|
||||
@@ -1,65 +1,65 @@
|
||||
import Image from "next/image";
|
||||
import type { GuideDefinition } from "@/lib/guides/types";
|
||||
import { TikTokLayout } from "./tiktok-layout";
|
||||
|
||||
function PlatformLogo({
|
||||
domain,
|
||||
className = "size-4",
|
||||
}: {
|
||||
domain: string;
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<Image
|
||||
src={`https://cdn.brandfetch.io/${domain}/w/64/h/64`}
|
||||
alt=""
|
||||
width={18}
|
||||
height={18}
|
||||
className={className}
|
||||
draggable={false}
|
||||
unoptimized
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function PlatformGuidePreview({ domain }: { domain: string }) {
|
||||
return <PlatformLogo domain={domain} />;
|
||||
}
|
||||
|
||||
function platformGuide({
|
||||
id,
|
||||
label,
|
||||
domain,
|
||||
}: {
|
||||
id: string;
|
||||
label: string;
|
||||
domain: string;
|
||||
}): GuideDefinition {
|
||||
return {
|
||||
id,
|
||||
label,
|
||||
renderPreview: () => <PlatformGuidePreview domain={domain} />,
|
||||
renderTriggerIcon: () => <PlatformLogo domain={domain} />,
|
||||
renderOverlay: () => null,
|
||||
};
|
||||
}
|
||||
|
||||
export const tiktokGuide: GuideDefinition = {
|
||||
...platformGuide({ id: "tiktok", label: "TikTok", domain: "tiktok.com" }),
|
||||
renderOverlay: () => <TikTokLayout />,
|
||||
};
|
||||
export const igReelsGuide = platformGuide({
|
||||
id: "ig-reels",
|
||||
label: "Reels",
|
||||
domain: "instagram.com",
|
||||
});
|
||||
export const ytShortsGuide = platformGuide({
|
||||
id: "yt-shorts",
|
||||
label: "Shorts",
|
||||
domain: "youtube.com",
|
||||
});
|
||||
export const spotlightGuide = platformGuide({
|
||||
id: "spotlight",
|
||||
label: "Spotlight",
|
||||
domain: "snapchat.com",
|
||||
});
|
||||
import Image from "next/image";
|
||||
import type { GuideDefinition } from "@/lib/guides/types";
|
||||
import { TikTokLayout } from "./tiktok-layout";
|
||||
|
||||
function PlatformLogo({
|
||||
domain,
|
||||
className = "size-4",
|
||||
}: {
|
||||
domain: string;
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<Image
|
||||
src={`https://cdn.brandfetch.io/${domain}/w/64/h/64`}
|
||||
alt=""
|
||||
width={18}
|
||||
height={18}
|
||||
className={className}
|
||||
draggable={false}
|
||||
unoptimized
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function PlatformGuidePreview({ domain }: { domain: string }) {
|
||||
return <PlatformLogo domain={domain} />;
|
||||
}
|
||||
|
||||
function platformGuide({
|
||||
id,
|
||||
label,
|
||||
domain,
|
||||
}: {
|
||||
id: string;
|
||||
label: string;
|
||||
domain: string;
|
||||
}): GuideDefinition {
|
||||
return {
|
||||
id,
|
||||
label,
|
||||
renderPreview: () => <PlatformGuidePreview domain={domain} />,
|
||||
renderTriggerIcon: () => <PlatformLogo domain={domain} />,
|
||||
renderOverlay: () => null,
|
||||
};
|
||||
}
|
||||
|
||||
export const tiktokGuide: GuideDefinition = {
|
||||
...platformGuide({ id: "tiktok", label: "TikTok", domain: "tiktok.com" }),
|
||||
renderOverlay: () => <TikTokLayout />,
|
||||
};
|
||||
export const igReelsGuide = platformGuide({
|
||||
id: "ig-reels",
|
||||
label: "Reels",
|
||||
domain: "instagram.com",
|
||||
});
|
||||
export const ytShortsGuide = platformGuide({
|
||||
id: "yt-shorts",
|
||||
label: "Shorts",
|
||||
domain: "youtube.com",
|
||||
});
|
||||
export const spotlightGuide = platformGuide({
|
||||
id: "spotlight",
|
||||
label: "Spotlight",
|
||||
domain: "snapchat.com",
|
||||
});
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,13 +1,13 @@
|
||||
import { GUIDE_REGISTRY } from "./registry";
|
||||
import type { GuideDefinition } from "@/lib/guides/types";
|
||||
|
||||
export { GUIDE_REGISTRY, isGuideId } from "./registry";
|
||||
export type { GuideDefinition, GuideId, GuideRenderProps } from "./registry";
|
||||
|
||||
export function getGuideById(guideId: string | null): GuideDefinition | null {
|
||||
if (!guideId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return GUIDE_REGISTRY.find((guide) => guide.id === guideId) ?? null;
|
||||
}
|
||||
import { GUIDE_REGISTRY } from "./registry";
|
||||
import type { GuideDefinition } from "@/lib/guides/types";
|
||||
|
||||
export { GUIDE_REGISTRY, isGuideId } from "./registry";
|
||||
export type { GuideDefinition, GuideId, GuideRenderProps } from "./registry";
|
||||
|
||||
export function getGuideById(guideId: string | null): GuideDefinition | null {
|
||||
if (!guideId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return GUIDE_REGISTRY.find((guide) => guide.id === guideId) ?? null;
|
||||
}
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
import type { GuideDefinition } from "@/lib/guides/types";
|
||||
import { gridGuide } from "./definitions/grid";
|
||||
// import { customGuide } from "./definitions/custom";
|
||||
import {
|
||||
tiktokGuide,
|
||||
igReelsGuide,
|
||||
ytShortsGuide,
|
||||
spotlightGuide,
|
||||
} from "./definitions/platforms";
|
||||
|
||||
export type { GuideDefinition, GuideRenderProps } from "@/lib/guides/types";
|
||||
|
||||
export const GUIDE_REGISTRY = [
|
||||
gridGuide,
|
||||
tiktokGuide,
|
||||
igReelsGuide,
|
||||
ytShortsGuide,
|
||||
spotlightGuide,
|
||||
|
||||
// todo: wire up custom guide fully, then uncomment this:
|
||||
// customGuide,
|
||||
] as const satisfies readonly GuideDefinition[];
|
||||
|
||||
export type GuideId = (typeof GUIDE_REGISTRY)[number]["id"];
|
||||
|
||||
export function isGuideId(value: string): value is GuideId {
|
||||
return GUIDE_REGISTRY.some((guide) => guide.id === value);
|
||||
}
|
||||
import type { GuideDefinition } from "@/lib/guides/types";
|
||||
import { gridGuide } from "./definitions/grid";
|
||||
// import { customGuide } from "./definitions/custom";
|
||||
import {
|
||||
tiktokGuide,
|
||||
igReelsGuide,
|
||||
ytShortsGuide,
|
||||
spotlightGuide,
|
||||
} from "./definitions/platforms";
|
||||
|
||||
export type { GuideDefinition, GuideRenderProps } from "@/lib/guides/types";
|
||||
|
||||
export const GUIDE_REGISTRY = [
|
||||
gridGuide,
|
||||
tiktokGuide,
|
||||
igReelsGuide,
|
||||
ytShortsGuide,
|
||||
spotlightGuide,
|
||||
|
||||
// todo: wire up custom guide fully, then uncomment this:
|
||||
// customGuide,
|
||||
] as const satisfies readonly GuideDefinition[];
|
||||
|
||||
export type GuideId = (typeof GUIDE_REGISTRY)[number]["id"];
|
||||
|
||||
export function isGuideId(value: string): value is GuideId {
|
||||
return GUIDE_REGISTRY.some((guide) => guide.id === value);
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
export interface GridConfig {
|
||||
rows: number;
|
||||
cols: number;
|
||||
}
|
||||
|
||||
export interface GuideRenderProps {
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
export interface GuideDefinition {
|
||||
id: string;
|
||||
label: string;
|
||||
renderPreview: () => ReactNode;
|
||||
renderTriggerIcon: () => ReactNode;
|
||||
renderOverlay: (props: GuideRenderProps) => ReactNode;
|
||||
renderOptions?: () => ReactNode;
|
||||
}
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
export interface GridConfig {
|
||||
rows: number;
|
||||
cols: number;
|
||||
}
|
||||
|
||||
export interface GuideRenderProps {
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
export interface GuideDefinition {
|
||||
id: string;
|
||||
label: string;
|
||||
renderPreview: () => ReactNode;
|
||||
renderTriggerIcon: () => ReactNode;
|
||||
renderOverlay: (props: GuideRenderProps) => ReactNode;
|
||||
renderOptions?: () => ReactNode;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user