Skip to content

Commit

Permalink
feat: YouTube handle in nameplate (#752)
Browse files Browse the repository at this point in the history
  • Loading branch information
cma2819 authored Aug 9, 2024
1 parent 02868bb commit c49b32d
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 22 deletions.
4 changes: 3 additions & 1 deletion schemas/lib/run.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"twitch": {"type": "string"},
"nico": {"type": "string"},
"twitter": {"type": "string"},
"youtube": {"type": "string"},
"camera": {
"type": "boolean",
"description": "人ごとのカメラ使用有無"
Expand All @@ -47,7 +48,8 @@
"name": {"type": "string"},
"twitch": {"type": "string"},
"nico": {"type": "string"},
"twitter": {"type": "string"}
"twitter": {"type": "string"},
"youtube": {"type": "string"}
},
"required": ["name"]
},
Expand Down
28 changes: 16 additions & 12 deletions src/browser/dashboard/components/schedule/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,17 +215,17 @@ export const EditRun: FC<Props> = ({edit, defaultValue, onFinish}) => {
}}
/>
<TextField
label={`走者${index + 1} ニコ生`}
value={runner.nico}
label={`走者${index + 1} Twitter`}
value={runner.twitter}
onChange={(e) => {
updateRunnerInfo(index, "nico", e.currentTarget.value);
updateRunnerInfo(index, "twitter", e.currentTarget.value);
}}
/>
<TextField
label={`走者${index + 1} Twitter`}
value={runner.twitter}
label={`走者${index + 1} YouTube`}
value={runner.youtube}
onChange={(e) => {
updateRunnerInfo(index, "twitter", e.currentTarget.value);
updateRunnerInfo(index, "youtube", e.currentTarget.value);
}}
/>
<FormControl>
Expand Down Expand Up @@ -310,19 +310,23 @@ export const EditRun: FC<Props> = ({edit, defaultValue, onFinish}) => {
}}
/>
<TextField
label={`解説${index + 1} ニコ生`}
defaultValue={commentator.nico}
label={`解説${index + 1} Twitter`}
defaultValue={commentator.twitter}
onChange={(e) => {
updateCommentatorInfo(index, "nico", e.currentTarget.value);
updateCommentatorInfo(
index,
"twitter",
e.currentTarget.value,
);
}}
/>
<TextField
label={`解説${index + 1} Twitter`}
defaultValue={commentator.twitter}
label={`解説${index + 1} YouTube`}
defaultValue={commentator.youtube}
onChange={(e) => {
updateCommentatorInfo(
index,
"twitter",
"youtube",
e.currentTarget.value,
);
}}
Expand Down
10 changes: 5 additions & 5 deletions src/browser/graphics/components/nameplate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -85,8 +85,8 @@ const NamePlateContent = ({
{display === "twitch" && (
<SocialText icon={iconTwitch} text={runner?.twitch} />
)}
{display === "nico" && (
<SocialText icon={iconNico} text={runner?.nico} />
{display === "youtube" && (
<SocialText icon={iconYoutube} text={runner?.youtube} />
)}
</FadeContainer>
)}
Expand Down Expand Up @@ -126,8 +126,8 @@ const NamePlateContent = ({
{display === "twitch" && (
<SocialText icon={iconTwitch} text={runner?.twitch} />
)}
{display === "nico" && (
<SocialText icon={iconNico} text={runner?.nico} />
{display === "youtube" && (
<SocialText icon={iconYoutube} text={runner?.youtube} />
)}
</FadeContainer>
)}
Expand Down
8 changes: 4 additions & 4 deletions src/browser/graphics/components/nameplate/sync-display.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<DisplayLabel>("name");

Expand All @@ -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) {
Expand All @@ -39,7 +39,7 @@ export const SyncDisplayProvider = ({children}: {children: ReactNode}) => {
return () => {
tl.kill();
};
}, [displayTwitter, displayTwitch, displayNico]);
}, [displayTwitter, displayTwitch, displayYoutube]);

return (
<SyncDisplayContext.Provider value={display}>
Expand Down
2 changes: 2 additions & 0 deletions src/extension/tracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
});
Expand Down Expand Up @@ -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,
};
Expand Down

0 comments on commit c49b32d

Please sign in to comment.