Skip to content

Commit 654d27f

Browse files
committed
🎨 [local] 諸々
1 parent bce6a69 commit 654d27f

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

src/miraktest-local/components/FileSelector.tsx

+13-10
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ export const FileSelector: React.VFC<{
1818
openContentPlayer: (_: ContentPlayerPlayingContent) => Promise<number>
1919
requestDialog: Parameters<InitPluginInRenderer>[0]["rpc"]["requestDialog"]
2020
}> = ({ services, setPlayingContent, openContentPlayer, requestDialog }) => {
21-
const [filePath, setFilePath] = useState("")
22-
const [startAt, setStartAt] = useState("")
21+
const [url, setFilePath] = useState("")
22+
const [startAt, setStartAt] = useState(
23+
dayjs().startOf("hour").format("YYYY-MM-DDTHH:mm")
24+
)
2325
const [duration, setDuration] = useState(30)
2426
const [serviceId, setServiceId] = useState(-1)
2527

@@ -34,13 +36,13 @@ export const FileSelector: React.VFC<{
3436
</div>
3537
<div className="w-full flex overflow-auto p-4">
3638
<form
39+
className={clsx("w-full")}
3740
onSubmit={(e) => {
3841
e.preventDefault()
39-
if (!filePath) {
42+
if (!url) {
4043
return
4144
}
4245
const contentType = "Local"
43-
const url = "file://" + filePath
4446
const service = services.find(
4547
(service) => service.serviceId === serviceId
4648
)
@@ -77,11 +79,12 @@ export const FileSelector: React.VFC<{
7779
className={clsx(
7880
"block mt-1 form-input rounded-l-md w-full text-gray-900 focus:outline-none cursor-pointer"
7981
)}
80-
value={filePath || ""}
82+
value={url || ""}
8183
onChange={(e) => setFilePath(e.target.value)}
8284
spellCheck={false}
8385
/>
8486
<button
87+
type="button"
8588
className={clsx(
8689
`px-4 py-2 mt-1 rounded-r-md flex items-center justify-center bg-gray-200 text-gray-900 focus:outline-none cursor-pointer`
8790
)}
@@ -96,14 +99,14 @@ export const FileSelector: React.VFC<{
9699
if (!path) {
97100
return
98101
}
99-
setFilePath(path)
102+
setFilePath("file://" + path)
100103
}}
101104
>
102105
<File className="pointer-events-none" size="1.75rem" />
103106
</button>
104107
</div>
105108
</label>
106-
<div className={clsx("flex", "space-x-2")}>
109+
<div className={clsx("flex", "space-x-2", "W-full")}>
107110
<label className="block mt-2">
108111
<span>開始時間</span>
109112
<input
@@ -127,10 +130,10 @@ export const FileSelector: React.VFC<{
127130
setDuration(p)
128131
}}
129132
/>
130-
{startAt ? (
133+
{startAt && dayjs(startAt).isValid() ? (
131134
<span>{dayjs(startAt).add(duration, "minutes").format()}</span>
132135
) : (
133-
<span>未選択</span>
136+
<span>無効な日付</span>
134137
)}
135138
</label>
136139
</div>
@@ -151,7 +154,7 @@ export const FileSelector: React.VFC<{
151154
</option>
152155
{services.map((service) => {
153156
return (
154-
<option key={service.serviceId} value={service.serviceId}>
157+
<option key={service.id} value={service.serviceId}>
155158
{service.name}
156159
</option>
157160
)

src/miraktest-local/constants.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export const LOCAL_META = {
44
id: LOCAL_ID,
55
name: "Local",
66
author: "ci7lus",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
description: "ローカルファイルの再生を行うプラグインです。",
99
authorUrl: "https://github.com/ci7lus",
1010
url: "https://github.com/ci7lus/miraktest-plugins/tree/master/src/miraktest-local",

0 commit comments

Comments
 (0)