Skip to content

Commit cb2fa5f

Browse files
committed
🚸 annictの操作感を改善
1 parent bc15fd0 commit cb2fa5f

File tree

3 files changed

+26
-34
lines changed

3 files changed

+26
-34
lines changed

src/miraktest-annict/components/AnnictTrack.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ export const AnnictTrack: React.FC<{
9494
return
9595
}
9696
setEpisodeId(found?.annictId)
97-
setEpisodeInfo(null)
9897
}, [episodeInfo, work])
9998
useEffect(() => {
10099
if (!workId) {
@@ -115,7 +114,7 @@ export const AnnictTrack: React.FC<{
115114
})
116115
.catch(console.error)
117116
.finally(() => setIsLoading(false))
118-
}, [workId, linkedAt, timing])
117+
}, [workId, timing])
119118
const [isStatusChanging, setIsStatusChanging] = useState(false)
120119
useEffect(() => {
121120
if (!work || work.viewerStatusState === watchStatus) {

src/miraktest-annict/components/SeachWorkForm.tsx

+23-30
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const SearchWorkForm: React.FC<{
4848
)
4949

5050
return (
51-
<div className={clsx("relative")}>
51+
<div className={clsx("relative")} onMouseLeave={() => setIsVisible(false)}>
5252
<form
5353
className="flex items-center justify-center space-x-2"
5454
onSubmit={(e) => {
@@ -81,38 +81,32 @@ export const SearchWorkForm: React.FC<{
8181
"transition-opacity",
8282
!isVisible || works === null
8383
? "opacity-0 pointer-events-none"
84-
: "opacity-100"
84+
: "opacity-100",
85+
"bg-gray-700",
86+
"overflow-auto",
87+
"p-2",
88+
"rounded-md"
8589
)}
86-
onMouseLeave={() => setIsVisible(false)}
90+
style={{ maxHeight: "66vh" }}
8791
>
8892
{works !== null ? (
8993
0 < works.length ? (
90-
<div
91-
className={clsx(
92-
"w-full",
93-
"bg-gray-700",
94-
"overflow-auto",
95-
"p-2",
96-
"rounded-md"
97-
)}
98-
>
99-
{(works || []).map((work) => (
100-
<p
101-
key={work.id}
102-
className={clsx(
103-
"truncate",
104-
"cursor-pointer",
105-
"px-2",
106-
"py-1",
107-
"hover:bg-gray-600",
108-
"transition-colors"
109-
)}
110-
onClick={() => setWorkId(work.annictId)}
111-
>
112-
{work.title}
113-
</p>
114-
))}
115-
</div>
94+
(works || []).map((work) => (
95+
<p
96+
key={work.id}
97+
className={clsx(
98+
"truncate",
99+
"cursor-pointer",
100+
"px-2",
101+
"py-1",
102+
"hover:bg-gray-600",
103+
"transition-colors"
104+
)}
105+
onClick={() => setWorkId(work.annictId)}
106+
>
107+
{work.title}
108+
</p>
109+
))
116110
) : (
117111
<div
118112
className={clsx(
@@ -121,7 +115,6 @@ export const SearchWorkForm: React.FC<{
121115
"justify-center",
122116
"p-8",
123117
"text-gray-400",
124-
"bg-gray-700",
125118
"w-full",
126119
"text-sm"
127120
)}

src/miraktest-annict/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ const main: InitPlugin = {
157157
}, [])
158158
const [sayaDefinition, setSayaDefinition] =
159159
useState<SayaDefinition | null>(null)
160-
const [arm, setArm] = useState<ARM[]>([])
160+
const [arm, setArm] = useState<ARM[] | null>(null)
161161
useEffect(() => {
162162
Axios.get<string>(
163163
"https://raw.githack.com/SlashNephy/saya/dev/docs/definitions.yml",
@@ -182,7 +182,7 @@ const main: InitPlugin = {
182182
<>
183183
<style>{tailwind}</style>
184184
<div className="w-full h-screen bg-gray-900 text-gray-100 flex leading-loose">
185-
{setting.accessToken && services && sayaDefinition ? (
185+
{setting.accessToken && services && sayaDefinition && arm ? (
186186
<AnnictTrack
187187
accessToken={setting.accessToken}
188188
playingContent={playingContent}

0 commit comments

Comments
 (0)