From c49b32d29547800bb8692fbe55a4c18188679fca Mon Sep 17 00:00:00 2001 From: Cma <33190610+cma2819@users.noreply.github.com> Date: Fri, 9 Aug 2024 12:20:46 +0900 Subject: [PATCH] feat: YouTube handle in nameplate (#752) --- schemas/lib/run.json | 4 ++- .../dashboard/components/schedule/edit.tsx | 28 +++++++++++-------- .../graphics/components/nameplate/index.tsx | 10 +++---- .../components/nameplate/sync-display.tsx | 8 +++--- src/extension/tracker.ts | 2 ++ 5 files changed, 30 insertions(+), 22 deletions(-) diff --git a/schemas/lib/run.json b/schemas/lib/run.json index f8fa3237..00a9f744 100644 --- a/schemas/lib/run.json +++ b/schemas/lib/run.json @@ -28,6 +28,7 @@ "twitch": {"type": "string"}, "nico": {"type": "string"}, "twitter": {"type": "string"}, + "youtube": {"type": "string"}, "camera": { "type": "boolean", "description": "人ごとのカメラ使用有無" @@ -47,7 +48,8 @@ "name": {"type": "string"}, "twitch": {"type": "string"}, "nico": {"type": "string"}, - "twitter": {"type": "string"} + "twitter": {"type": "string"}, + "youtube": {"type": "string"} }, "required": ["name"] }, diff --git a/src/browser/dashboard/components/schedule/edit.tsx b/src/browser/dashboard/components/schedule/edit.tsx index 5c9ed3a4..7f3eb3fb 100644 --- a/src/browser/dashboard/components/schedule/edit.tsx +++ b/src/browser/dashboard/components/schedule/edit.tsx @@ -215,17 +215,17 @@ export const EditRun: FC = ({edit, defaultValue, onFinish}) => { }} /> { - updateRunnerInfo(index, "nico", e.currentTarget.value); + updateRunnerInfo(index, "twitter", e.currentTarget.value); }} /> { - updateRunnerInfo(index, "twitter", e.currentTarget.value); + updateRunnerInfo(index, "youtube", e.currentTarget.value); }} /> @@ -310,19 +310,23 @@ export const EditRun: FC = ({edit, defaultValue, onFinish}) => { }} /> { - updateCommentatorInfo(index, "nico", e.currentTarget.value); + updateCommentatorInfo( + index, + "twitter", + e.currentTarget.value, + ); }} /> { updateCommentatorInfo( index, - "twitter", + "youtube", e.currentTarget.value, ); }} diff --git a/src/browser/graphics/components/nameplate/index.tsx b/src/browser/graphics/components/nameplate/index.tsx index 61224b52..59124eef 100644 --- a/src/browser/graphics/components/nameplate/index.tsx +++ b/src/browser/graphics/components/nameplate/index.tsx @@ -2,7 +2,7 @@ import {ThinText, TimerText} from "../lib/text"; import {useCurrentRun, useTimer} from "../lib/hooks"; import iconTwitter from "../../images/icon/icon_twitter.svg"; import iconTwitch from "../../images/icon/icon_twitch.svg"; -import iconNico from "../../images/icon/icon_nico.svg"; +import iconYoutube from "../../images/icon/icon_youtube.svg"; import iconRunner from "../../images/icon/icon_runner.svg"; import iconCommentator from "../../images/icon/icon_commentary.svg"; import {CSSProperties, HTMLAttributes, useContext, useRef} from "react"; @@ -85,8 +85,8 @@ const NamePlateContent = ({ {display === "twitch" && ( )} - {display === "nico" && ( - + {display === "youtube" && ( + )} )} @@ -126,8 +126,8 @@ const NamePlateContent = ({ {display === "twitch" && ( )} - {display === "nico" && ( - + {display === "youtube" && ( + )} )} diff --git a/src/browser/graphics/components/nameplate/sync-display.tsx b/src/browser/graphics/components/nameplate/sync-display.tsx index f373e3f9..6602c213 100644 --- a/src/browser/graphics/components/nameplate/sync-display.tsx +++ b/src/browser/graphics/components/nameplate/sync-display.tsx @@ -2,7 +2,7 @@ import gsap from "gsap"; import {ReactNode, createContext, useEffect, useState} from "react"; import {useReplicant} from "../../../use-replicant"; -type DisplayLabel = "name" | "twitter" | "twitch" | "nico"; +type DisplayLabel = "name" | "twitter" | "twitch" | "youtube"; export const SyncDisplayContext = createContext("name"); @@ -17,14 +17,14 @@ export const SyncDisplayProvider = ({children}: {children: ReactNode}) => { const displayTwitter = participants.some((p) => Boolean(p?.twitter)); const displayTwitch = participants.some((p) => Boolean(p?.twitch)); - const displayNico = participants.some((p) => Boolean(p?.nico)); + const displayYoutube = participants.some((p) => Boolean(p?.youtube)); useEffect(() => { const tl = gsap.timeline({repeat: -1}); const displays: DisplayLabel[] = [ displayTwitter ? "twitter" : null, displayTwitch ? "twitch" : null, - displayNico ? "nico" : null, + displayYoutube ? "youtube" : null, "name", ].filter((v): v is DisplayLabel => v !== null); for (const social of displays) { @@ -39,7 +39,7 @@ export const SyncDisplayProvider = ({children}: {children: ReactNode}) => { return () => { tl.kill(); }; - }, [displayTwitter, displayTwitch, displayNico]); + }, [displayTwitter, displayTwitch, displayYoutube]); return ( diff --git a/src/extension/tracker.ts b/src/extension/tracker.ts index 97d62ed7..d2adf4fb 100644 --- a/src/extension/tracker.ts +++ b/src/extension/tracker.ts @@ -91,6 +91,7 @@ export const tracker = async (nodecg: NodeCG) => { twitter: el["Twitter ID"] as string, twitch: el["Twitch ID"] as string, nico: el["ニコニココミュニティ ID"] as string, + youtube: el["YouTube ハンドル"] as string, gameCategory: el["担当ゲームカテゴリ"] as string, }; }); @@ -145,6 +146,7 @@ export const tracker = async (nodecg: NodeCG) => { name: runner?.fields.name ?? "", twitch: runner?.fields.twitch, nico: runner?.fields.nico, + youtube: runner?.fields.youtube, twitter: runner?.fields.twitter, camera: true, };