diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 9aaf8fc2..cbcdb3d2 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -61,6 +61,7 @@ "../connectors/meta/**/*": "connectors/meta/", "../connectors/openai/**/*": "connectors/openai/", "../connectors/spotify/**/*": "connectors/spotify/", + "../connectors/x/**/*": "connectors/x/", "../playwright-runner/dist/*": "playwright-runner/dist/", "../personal-server/dist/personal-server*": "personal-server/dist/" }, diff --git a/src/components/icons/platform-x.tsx b/src/components/icons/platform-x.tsx new file mode 100644 index 00000000..bc15cd23 --- /dev/null +++ b/src/components/icons/platform-x.tsx @@ -0,0 +1,19 @@ +import { Svg as SvgComponent, type SvgIconProps } from "@/components/utils/svg" + +export const PlatformXIcon = (props: SvgIconProps) => { + return ( + + + + + + + + + + + ) +} diff --git a/src/lib/platform/icons.ts b/src/lib/platform/icons.ts index 6d8b46ff..f74bd7af 100644 --- a/src/lib/platform/icons.ts +++ b/src/lib/platform/icons.ts @@ -1,10 +1,10 @@ import type { ElementType } from "react" -import { IconX } from "@/components/icons/icon-x" import { PlatformChatGPTIcon } from "@/components/icons/platform-chatgpt" import { PlatformGithubIcon } from "@/components/icons/platform-github" import { PlatformInstagramGlyphIcon } from "@/components/icons/platform-instagram-glyph" import { PlatformLinkedinIcon } from "@/components/icons/platform-linkedin" import { PlatformSpotifyIcon } from "@/components/icons/platform-spotify" +import { PlatformXIcon } from "@/components/icons/platform-x" import type { PlatformRegistryEntry } from "./registry" import { getPlatformRegistryEntry, @@ -20,7 +20,7 @@ const PLATFORM_ICON_COMPONENTS: Record = { instagram: PlatformInstagramGlyphIcon, linkedin: PlatformLinkedinIcon, spotify: PlatformSpotifyIcon, - x: IconX, + x: PlatformXIcon, } const resolveIconComponentForEntry = (entry: PlatformRegistryEntry | null) => { diff --git a/src/lib/platform/registry.ts b/src/lib/platform/registry.ts index 949a75c7..b02498df 100644 --- a/src/lib/platform/registry.ts +++ b/src/lib/platform/registry.ts @@ -76,19 +76,15 @@ export const PLATFORM_REGISTRY: PlatformRegistryEntry[] = [ }, { id: "x", - displayName: "X (Twitter)", + displayName: "X", iconKey: "x", iconEmoji: "𝕏", primaryColor: "#111111", - platformIds: ["x"], - aliases: ["x (twitter)"], - }, - { - id: "twitter", - displayName: "Twitter", - iconEmoji: "🐦", - primaryColor: "#1D9BF0", - platformIds: ["twitter"], + platformIds: ["x-playwright", "x"], + aliases: ["twitter", "x (twitter)"], + availability: "requiresConnector", + showInConnectList: true, + ingestScope: "x.posts", }, { id: "reddit", diff --git a/src/lib/platform/utils.test.ts b/src/lib/platform/utils.test.ts new file mode 100644 index 00000000..635902b3 --- /dev/null +++ b/src/lib/platform/utils.test.ts @@ -0,0 +1,55 @@ +import { describe, expect, it } from "vitest" +import { resolvePlatformForEntry, getPlatformRegistryEntryById } from "./utils" + +describe("platform registry resolution", () => { + it("treats x-playwright as the canonical X connector", () => { + const entry = getPlatformRegistryEntryById("x-playwright") + + expect(entry).toMatchObject({ + id: "x", + displayName: "X", + ingestScope: "x.posts", + }) + }) + + it("keeps legacy twitter lookups pointed at the canonical X entry", () => { + const entry = getPlatformRegistryEntryById("twitter") + + expect(entry).toMatchObject({ + id: "x", + displayName: "X", + }) + }) + + it("resolves the runtime x-playwright platform for the X entry", () => { + const entry = getPlatformRegistryEntryById("x") + + expect(entry).toBeTruthy() + if (!entry) { + throw new Error("Expected X entry to exist") + } + + const resolved = resolvePlatformForEntry( + [ + { + id: "x-playwright", + company: "X", + name: "X", + filename: "x-playwright", + description: "X export", + isUpdated: false, + logoURL: "", + needsConnection: true, + connectURL: null, + connectSelector: null, + exportFrequency: null, + vectorize_config: null, + runtime: "playwright", + }, + ], + entry + ) + + expect(resolved?.id).toBe("x-playwright") + }) +}) diff --git a/src/lib/scope-labels.ts b/src/lib/scope-labels.ts index 03042d9a..b5412791 100644 --- a/src/lib/scope-labels.ts +++ b/src/lib/scope-labels.ts @@ -1,8 +1,7 @@ const DATA_SOURCE_LABELS: Record = { chatgpt: "ChatGPT", reddit: "Reddit", - twitter: "Twitter", - x: "X (Twitter)", + x: "X", instagram: "Instagram", linkedin: "LinkedIn", spotify: "Spotify",