dsh-mcviseron-plugin 0.0.0-stage → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +222 -0
  2. package/CONTRIBUTING.md +60 -0
  3. package/LICENSE +202 -0
  4. package/README.en.md +146 -0
  5. package/README.md +287 -2
  6. package/SECURITY.md +38 -0
  7. package/cordis.patch.yml +12 -0
  8. package/docs/automation-task.md +63 -0
  9. package/docs/migration-from-standalone.md +115 -0
  10. package/docs/release.md +85 -0
  11. package/lib/appearance.js +320 -0
  12. package/lib/auto-review-fix.js +453 -0
  13. package/lib/client.js +1266 -0
  14. package/lib/index.js +1701 -0
  15. package/lib/restart.js +226 -0
  16. package/lib/task-guard.js +736 -0
  17. package/package.json +148 -4
  18. package/scripts/repair-profile.mjs +77 -0
  19. package/src/api.ts +5 -0
  20. package/src/appearance/index.ts +103 -0
  21. package/src/auto-review-fix/index.ts +45 -0
  22. package/src/client/AppearanceScheduleRow.tsx +112 -0
  23. package/src/client/ConfigForm.tsx +284 -0
  24. package/src/client/FallbackRestartRow.tsx +23 -0
  25. package/src/client/RestartCard.tsx +108 -0
  26. package/src/client/SettingsSection.tsx +110 -0
  27. package/src/client/bridge.ts +131 -0
  28. package/src/client/driver.ts +166 -0
  29. package/src/client/index.ts +114 -0
  30. package/src/client/locales.ts +193 -0
  31. package/src/client/primitives.d.ts +15 -0
  32. package/src/client/section-presence.ts +33 -0
  33. package/src/client/styles.ts +154 -0
  34. package/src/components/auto-review-fix/index.ts +421 -0
  35. package/src/components/auto-review-fix/translate.ts +235 -0
  36. package/src/components/task-guard/index.ts +1077 -0
  37. package/src/index.ts +71 -0
  38. package/src/loopback.ts +48 -0
  39. package/src/namespace.ts +7 -0
  40. package/src/restart/index.ts +268 -0
  41. package/src/routes.ts +228 -0
  42. package/src/schedule.ts +125 -0
  43. package/src/task-guard/index.ts +52 -0
  44. package/src/volatile.ts +32 -0
package/package.json CHANGED
@@ -1,6 +1,150 @@
1
1
  {
2
2
  "name": "dsh-mcviseron-plugin",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.6.2",
4
+ "description": "DeepSeek Harness (DSH) master plugin — one package hosting MCviseron's DSH components as separate bundle entries: a time-based light/dark Appearance schedule, an Auto-review fix (shutdown preset guard + Chinese approval-reason translation), and a todo plan guard that keeps multi-stage work advancing.",
5
+ "license": "Apache-2.0",
6
+ "author": {
7
+ "name": "MCviseron",
8
+ "email": "2563969462@qq.com",
9
+ "url": "https://github.com/MCviseron"
10
+ },
11
+ "homepage": "https://github.com/MCviseron/dsh-mcviseron-plugin#readme",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/MCviseron/dsh-mcviseron-plugin.git"
15
+ },
16
+ "bugs": {
17
+ "url": "https://github.com/MCviseron/dsh-mcviseron-plugin/issues"
18
+ },
19
+ "keywords": [
20
+ "dsh",
21
+ "dsh-plugin",
22
+ "deepseek-harness",
23
+ "plugin",
24
+ "theme",
25
+ "appearance",
26
+ "light",
27
+ "dark",
28
+ "schedule",
29
+ "auto-review",
30
+ "approval",
31
+ "todo"
32
+ ],
33
+ "packageManager": "pnpm@10.6.3",
34
+ "engines": {
35
+ "node": "^22.19.0 || >=24"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public",
39
+ "registry": "https://registry.npmjs.org/"
40
+ },
41
+ "type": "module",
42
+ "main": "lib/appearance.js",
43
+ "exports": {
44
+ ".": "./lib/index.js",
45
+ "./appearance": "./lib/appearance.js",
46
+ "./auto-review-fix": "./lib/auto-review-fix.js",
47
+ "./task-guard": "./lib/task-guard.js",
48
+ "./client": "./lib/client.js",
49
+ "./cordis.patch.yml": "./cordis.patch.yml",
50
+ "./package.json": "./package.json",
51
+ "./restart": "./lib/restart.js"
52
+ },
53
+ "files": [
54
+ "lib",
55
+ "src",
56
+ "docs",
57
+ "scripts",
58
+ "cordis.patch.yml",
59
+ "README.md",
60
+ "README.en.md",
61
+ "CHANGELOG.md",
62
+ "CONTRIBUTING.md",
63
+ "SECURITY.md",
64
+ "LICENSE"
65
+ ],
66
+ "dsh": {
67
+ "bundle": {
68
+ "patch": "./cordis.patch.yml"
69
+ },
70
+ "client": {
71
+ "inject": [
72
+ "@deepseek-ai/dsh-client-ui-settings",
73
+ "@deepseek-ai/dsh-client-locale"
74
+ ],
75
+ "platform": "web"
76
+ }
77
+ },
78
+ "scripts": {
79
+ "build": "node build.mjs",
80
+ "typecheck": "tsc --noEmit",
81
+ "test": "node --experimental-strip-types test/schedule.test.ts && node --experimental-strip-types test/routes.test.ts && node --experimental-strip-types test/config.test.ts && node --experimental-strip-types test/auto-review-fix.test.ts && node --experimental-strip-types test/auto-review-fix-cordis.test.ts && node --experimental-strip-types test/task-guard.test.ts && node --experimental-strip-types test/task-guard-cordis.test.ts && node --experimental-strip-types test/restart.test.ts && node --experimental-strip-types test/plugin.test.ts",
82
+ "check": "pnpm typecheck && pnpm test && pnpm build",
83
+ "prepare": "pnpm build",
84
+ "prepublishOnly": "pnpm check",
85
+ "repair-profile": "node scripts/repair-profile.mjs"
86
+ },
87
+ "dependencies": {
88
+ "@deepseek-ai/schemastery": "^3.18.5"
89
+ },
90
+ "peerDependencies": {
91
+ "@deepseek-ai/cordis": "^4.0.1",
92
+ "@deepseek-ai/dsh-client-connection": "^0.2.0-rc.2 || ^0.2.1-rc.2",
93
+ "@deepseek-ai/dsh-client-locale": "^0.2.0-rc.2 || ^0.2.1-rc.2",
94
+ "@deepseek-ai/dsh-client-ui-settings": "^0.2.0-rc.2 || ^0.2.1-rc.2",
95
+ "@deepseek-ai/dsh-client-ui-slots": "^0.2.0-rc.2 || ^0.2.1-rc.2",
96
+ "@deepseek-ai/dsh-host-webserver": "^0.2.0-rc.2 || ^0.2.1-rc.2",
97
+ "@deepseek-ai/dsh-settings": "^0.2.0-rc.2 || ^0.2.1-rc.2",
98
+ "react": "^18.2.0",
99
+ "react-dom": "^18.2.0"
100
+ },
101
+ "peerDependenciesMeta": {
102
+ "@deepseek-ai/cordis": {
103
+ "optional": true
104
+ },
105
+ "@deepseek-ai/dsh-client-connection": {
106
+ "optional": true
107
+ },
108
+ "@deepseek-ai/dsh-client-locale": {
109
+ "optional": true
110
+ },
111
+ "@deepseek-ai/dsh-client-ui-settings": {
112
+ "optional": true
113
+ },
114
+ "@deepseek-ai/dsh-client-ui-slots": {
115
+ "optional": true
116
+ },
117
+ "@deepseek-ai/dsh-host-webserver": {
118
+ "optional": true
119
+ },
120
+ "@deepseek-ai/dsh-settings": {
121
+ "optional": true
122
+ },
123
+ "react": {
124
+ "optional": true
125
+ },
126
+ "react-dom": {
127
+ "optional": true
128
+ }
129
+ },
130
+ "devDependencies": {
131
+ "@types/node": "^22.20.0",
132
+ "@types/react": "~18.3.1",
133
+ "@types/react-dom": "^18.3.5",
134
+ "esbuild": "^0.24.0",
135
+ "immer": "10.2.0",
136
+ "zustand": "4.4.7",
137
+ "react": "^18.3.1",
138
+ "react-dom": "^18.3.1",
139
+ "typescript": "~5.7.2",
140
+ "@deepseek-ai/cordis": "^4.0.5",
141
+ "@deepseek-ai/dsh-client-connection": "^0.2.1-rc.2",
142
+ "@deepseek-ai/dsh-client-locale": "^0.2.1-rc.2",
143
+ "@deepseek-ai/dsh-client-store": "^0.2.1-rc.2",
144
+ "@deepseek-ai/dsh-client-ui-renderer": "^0.2.1-rc.2",
145
+ "@deepseek-ai/dsh-client-ui-settings": "^0.2.1-rc.2",
146
+ "@deepseek-ai/dsh-client-ui-slots": "^0.2.1-rc.2",
147
+ "@deepseek-ai/dsh-host-webserver": "^0.2.1-rc.2",
148
+ "@deepseek-ai/dsh-settings": "^0.2.1-rc.2"
149
+ }
150
+ }
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Repair a DSH profile after a raw `pnpm install`.
4
+ *
5
+ * On Windows pnpm resolves a cross-drive `link:D:/...` dependency into a
6
+ * broken relative symlink such as
7
+ * `<profile>\node_modules\<name> -> <profile>\D:\...`.
8
+ * The loader then reports every such plugin as "package unavailable" and the
9
+ * plugin manager may also drop those entries from `dsh.profile.bundles`.
10
+ *
11
+ * This script:
12
+ * 1. recreates every `link:` dependency as an absolute junction;
13
+ * 2. re-adds every linked package to `dsh.profile.bundles`;
14
+ * 3. reports missing targets instead of silently skipping them.
15
+ *
16
+ * Usage:
17
+ * node scripts/repair-profile.mjs [profileDir]
18
+ * Default profile: %USERPROFILE%/.dsh/profiles/desktop
19
+ */
20
+ import fs from 'node:fs'
21
+ import os from 'node:os'
22
+ import path from 'node:path'
23
+ import process from 'node:process'
24
+
25
+ const profile = process.argv[2] ?? path.join(os.homedir(), '.dsh', 'profiles', 'desktop')
26
+ const packagePath = path.join(profile, 'package.json')
27
+ if (!fs.existsSync(packagePath)) {
28
+ console.error('repair-profile: package.json not found at ' + packagePath)
29
+ process.exit(1)
30
+ }
31
+
32
+ const manifest = JSON.parse(fs.readFileSync(packagePath, 'utf8'))
33
+ const links = Object.entries(manifest.dependencies ?? {})
34
+ .filter(([, spec]) => typeof spec === 'string' && spec.startsWith('link:'))
35
+ .map(([name, spec]) => ({ name, target: spec.slice('link:'.length).replaceAll('/', path.sep) }))
36
+
37
+ let failures = 0
38
+ let repairs = 0
39
+ const bundles = manifest.dsh?.profile?.bundles ?? []
40
+ const added = []
41
+
42
+ for (const { name, target } of links) {
43
+ if (!fs.existsSync(path.join(target, 'package.json'))) {
44
+ console.error('MISSING target for ' + name + ': ' + target)
45
+ failures += 1
46
+ continue
47
+ }
48
+ const link = path.join(profile, 'node_modules', name)
49
+ let current = ''
50
+ try { current = fs.realpathSync(link) } catch { current = '' }
51
+ const expected = fs.realpathSync(target)
52
+ if (current !== expected) {
53
+ try { fs.unlinkSync(link) } catch { try { fs.rmdirSync(link) } catch { /* absent */ } }
54
+ fs.mkdirSync(path.dirname(link), { recursive: true })
55
+ fs.symlinkSync(target, link, 'junction')
56
+ repairs += 1
57
+ console.log('repaired ' + name + ' -> ' + target)
58
+ } else {
59
+ console.log('ok ' + name + ' -> ' + current)
60
+ }
61
+ if (!bundles.includes(name)) {
62
+ bundles.push(name)
63
+ added.push(name)
64
+ }
65
+ }
66
+
67
+ if (added.length > 0) {
68
+ manifest.dsh = manifest.dsh ?? {}
69
+ manifest.dsh.profile = manifest.dsh.profile ?? {}
70
+ manifest.dsh.profile.bundles = bundles
71
+ fs.writeFileSync(packagePath, JSON.stringify(manifest, null, 2) + '\n')
72
+ }
73
+
74
+ console.log('')
75
+ console.log('profile: ' + profile)
76
+ console.log('links checked: ' + links.length + ' | repaired: ' + repairs + ' | bundles restored: ' + (added.join(', ') || '(none)'))
77
+ process.exit(failures > 0 ? 1 : 0)
package/src/api.ts ADDED
@@ -0,0 +1,5 @@
1
+ /** Loopback endpoints shared by the Host bridge and the Appearance row. */
2
+ export const MCVISERON_API = {
3
+ describe: '/api/dsh-mcviseron/settings/describe',
4
+ mutate: '/api/dsh-mcviseron/settings/mutate',
5
+ } as const
@@ -0,0 +1,103 @@
1
+ import type { Context } from '@deepseek-ai/cordis'
2
+ import type {} from '@deepseek-ai/dsh-host-webserver'
3
+ import type {} from '@deepseek-ai/dsh-settings'
4
+ import z from '@deepseek-ai/schemastery'
5
+ import { isLoopbackRequest } from '../loopback.ts'
6
+ import { json, makeSettingsRoutes, type SettingsBridge } from '../routes.ts'
7
+ import { DEFAULT_SCHEDULE_CONFIG } from '../schedule.ts'
8
+
9
+ /**
10
+ * Appearance component (Host half).
11
+ *
12
+ * The schedule itself runs in the browser, so the Host contributes only the
13
+ * durable Config and the narrow loopback bridge the Appearance row writes
14
+ * through. The auto-generated settings page is switched off because the row is
15
+ * this component's shipped surface.
16
+ */
17
+
18
+ /** Settings-service faces this component probes. */
19
+ interface SettingsFormsFace extends SettingsBridge {
20
+ /** DSH >= 0.2: choose whether the auto-generated Config page is shown. */
21
+ configure?: (presentation: { auto?: boolean }) => () => void
22
+ }
23
+
24
+ export const Config = z.object({
25
+ enabled: z.boolean().default(DEFAULT_SCHEDULE_CONFIG.enabled).volatile(),
26
+ lightStart: z.string().pattern(/^([01]\d|2[0-3]):[0-5]\d$/).default(DEFAULT_SCHEDULE_CONFIG.lightStart).volatile(),
27
+ lightEnd: z.string().pattern(/^([01]\d|2[0-3]):[0-5]\d$/).default(DEFAULT_SCHEDULE_CONFIG.lightEnd).volatile(),
28
+ }).default({ ...DEFAULT_SCHEDULE_CONFIG })
29
+
30
+ export interface AppearanceConfig {
31
+ enabled?: boolean
32
+ lightStart?: string
33
+ lightEnd?: string
34
+ }
35
+
36
+ /** Read-only client-module diagnostics used while a settings page is missing. */
37
+ const DIAGNOSTICS_PATH = '/api/dsh-mcviseron/diagnostics'
38
+
39
+ export const inject = ['webServer']
40
+
41
+ /**
42
+ * Register the loopback settings bridge for the Appearance component.
43
+ * @param ctx - the component's plugin context.
44
+ * @param _config - resolved entry config (the browser reads it live).
45
+ */
46
+ export function apply(ctx: Context, _config?: AppearanceConfig): void {
47
+ ctx.effect(() => ctx.webServer.register({
48
+ kind: 'exact',
49
+ path: DIAGNOSTICS_PATH,
50
+ handler: async (req, res): Promise<void> => {
51
+ try {
52
+ if (req.method !== 'GET' && req.method !== 'POST') return json(res, 405, { ok: false, error: 'method-not-allowed' })
53
+ if (!isLoopbackRequest(req)) return json(res, 403, { ok: false, error: 'forbidden' })
54
+ const modules = (ctx as unknown as { get?: (name: string) => unknown }).get?.('clientModules') as {
55
+ clientPath?: (id: string) => string | undefined
56
+ graph?: () => { batches?: unknown[]; entries?: unknown[] }
57
+ release?: unknown
58
+ } | undefined
59
+ const graph = typeof modules?.graph === 'function' ? modules.graph() : undefined
60
+ const batches = Array.isArray(graph?.batches) ? graph.batches : []
61
+ const rows: unknown[] = []
62
+ const batchSummary: unknown[] = []
63
+ for (const batch of batches as Array<{ descriptor?: { phase?: string; entries?: unknown[] }; entries?: unknown[] }>) {
64
+ const entries = batch?.descriptor?.entries ?? batch?.entries ?? []
65
+ batchSummary.push({ phase: batch?.descriptor?.phase, count: entries.length })
66
+ for (const row of entries) rows.push(row)
67
+ }
68
+ const mcviseronRows = rows.filter((row) => JSON.stringify(row).includes('mcviseron'))
69
+ const loaderEntries: unknown[] = []
70
+ const loader = (ctx as unknown as { loader?: { entries?: () => Iterable<{ options?: { name?: string }; disabled?: boolean; fiber?: unknown }> } }).loader
71
+ for (const entry of loader?.entries?.() ?? []) {
72
+ if (String(entry.options?.name ?? '').includes('mcviseron')) {
73
+ loaderEntries.push({ name: entry.options?.name, disabled: Boolean(entry.disabled), fiber: Boolean(entry.fiber) })
74
+ }
75
+ }
76
+ json(res, 200, {
77
+ ok: true,
78
+ clientPath: modules?.clientPath?.('dsh-mcviseron-plugin') ?? null,
79
+ graphKeys: graph !== undefined ? Object.keys(graph) : null,
80
+ batches: batchSummary,
81
+ mcviseronRows,
82
+ loaderEntries,
83
+ release: modules?.release ?? null,
84
+ })
85
+ } catch (error) {
86
+ json(res, 500, { ok: false, error: error instanceof Error ? error.message : String(error) })
87
+ }
88
+ },
89
+ }), 'mcviseron-appearance: client diagnostics')
90
+
91
+ ctx.inject(['settings'], (sctx) => {
92
+ const settings = sctx.settings as unknown as SettingsFormsFace
93
+ if (typeof settings.configure === 'function') {
94
+ ctx.effect(() => settings.configure!({ auto: false }), 'mcviseron-appearance: settings page policy')
95
+ }
96
+ sctx.effect(() => {
97
+ const disposers = makeSettingsRoutes(settings).map(route => ctx.webServer.register(route))
98
+ return () => {
99
+ for (const dispose of disposers) dispose()
100
+ }
101
+ }, 'mcviseron-appearance: settings bridge')
102
+ })
103
+ }
@@ -0,0 +1,45 @@
1
+ import type { Context } from '@deepseek-ai/cordis'
2
+ import z from '@deepseek-ai/schemastery'
3
+ import { installAutoReview } from '../components/auto-review-fix/index.ts'
4
+ import { toPlain } from '../volatile.ts'
5
+
6
+ /**
7
+ * Auto-review fix component: shutdown preset guard + Chinese approval translation.
8
+ * The whole implementation lives in `components/auto-review`; this entry owns
9
+ * the profile Config so the plugin inventory can list the component on its own.
10
+ */
11
+ export const DEFAULT_AUTO_REVIEW_CONFIG = {
12
+ keepPresetGuard: true,
13
+ translateApprovalReason: true,
14
+ translateTimeoutMs: 6000,
15
+ translateMaxChars: 4000,
16
+ translateProvider: '',
17
+ translateModel: '',
18
+ } as const
19
+
20
+ export const Config = z.object({
21
+ keepPresetGuard: z.boolean().default(DEFAULT_AUTO_REVIEW_CONFIG.keepPresetGuard).volatile(),
22
+ translateApprovalReason: z.boolean().default(DEFAULT_AUTO_REVIEW_CONFIG.translateApprovalReason).volatile(),
23
+ translateTimeoutMs: z.number().min(500).max(60000).default(DEFAULT_AUTO_REVIEW_CONFIG.translateTimeoutMs).volatile(),
24
+ translateMaxChars: z.number().min(100).max(20000).default(DEFAULT_AUTO_REVIEW_CONFIG.translateMaxChars).volatile(),
25
+ translateProvider: z.string().default(DEFAULT_AUTO_REVIEW_CONFIG.translateProvider).volatile(),
26
+ translateModel: z.string().default(DEFAULT_AUTO_REVIEW_CONFIG.translateModel).volatile(),
27
+ }).default(DEFAULT_AUTO_REVIEW_CONFIG)
28
+
29
+ export interface AutoReviewConfig {
30
+ keepPresetGuard?: boolean
31
+ translateApprovalReason?: boolean
32
+ translateTimeoutMs?: number
33
+ translateMaxChars?: number
34
+ translateProvider?: string
35
+ translateModel?: string
36
+ }
37
+
38
+ /**
39
+ * Install the Auto-review component.
40
+ * @param ctx - the component's plugin context.
41
+ * @param config - the entry Config.
42
+ */
43
+ export function apply(ctx: Context, config?: AutoReviewConfig): void {
44
+ installAutoReview(ctx, toPlain(config))
45
+ }
@@ -0,0 +1,112 @@
1
+ import { useEffect, useState, useSyncExternalStore } from 'react'
2
+ import { formatTimeOfDay, nextTransition, parseTimeOfDay, periodAt } from '../schedule.ts'
3
+ import type { ScheduleDriver } from './driver.ts'
4
+ import type { McviseronKey } from './locales.ts'
5
+ import { Switch } from '@deepseek-ai/dsh-client-ui-primitives'
6
+ import { styles } from './styles.ts'
7
+
8
+ /** Props composed by the `settings.general.item` slot. */
9
+ export interface AppearanceScheduleRowProps {
10
+ /** Locale-bound translator for this plugin's namespace. */
11
+ t: (key: McviseronKey) => string
12
+ /** Injected driver, owned by the plugin (never by the row). */
13
+ driver: ScheduleDriver
14
+ }
15
+
16
+ /**
17
+ * The Appearance option: one row with the toggle, the customizable light
18
+ * window, and the live "current period / next switch" line. The row owns no
19
+ * timer of its own besides the clock label; the driver keeps switching themes
20
+ * after the settings page is closed.
21
+ * @param props - composed slot props.
22
+ * @returns the row element tree.
23
+ */
24
+ export function AppearanceScheduleRow({ t, driver }: AppearanceScheduleRowProps) {
25
+ const state = useSyncExternalStore(driver.subscribe, driver.getState, driver.getState)
26
+ const [now, setNow] = useState(() => new Date())
27
+
28
+ useEffect(() => {
29
+ const timer = setInterval(() => {
30
+ setNow(new Date())
31
+ }, 15_000)
32
+ return () => {
33
+ clearInterval(timer)
34
+ }
35
+ }, [])
36
+
37
+ useEffect(() => {
38
+ if (state.bridge === 'loading') void driver.refresh()
39
+ }, [driver, state.bridge])
40
+
41
+ const config = state.config
42
+ const next = nextTransition(now, config)
43
+ const period = periodAt(now, config)
44
+
45
+ const status = ((): string => {
46
+ if (state.bridge === 'unavailable') return t('status.unavailable')
47
+ if (!config.enabled) return t('status.off')
48
+ const periodText = t(period === 'light' ? 'status.light' : 'status.dark')
49
+ if (next === undefined) return periodText
50
+ return periodText + ' · ' + t('row.next') + ' ' + formatTimeOfDay(next.at.getHours() * 60 + next.at.getMinutes())
51
+ })()
52
+
53
+ const write = state.write === 'saving'
54
+ ? t('status.saving')
55
+ : state.write === 'failed'
56
+ ? t('status.failed')
57
+ : state.write === 'saved'
58
+ ? t('status.saved')
59
+ : ''
60
+
61
+ const toggle = (enabled: boolean): void => {
62
+ void driver.update({ enabled })
63
+ }
64
+
65
+ const changeTime = (field: 'lightStart' | 'lightEnd', value: string): void => {
66
+ if (parseTimeOfDay(value) === undefined) return
67
+ void driver.update(field === 'lightStart' ? { lightStart: value } : { lightEnd: value })
68
+ }
69
+
70
+ return (
71
+ <div style={styles.row}>
72
+ <div style={styles.text}>
73
+ <div style={styles.title}>{t('row.title')}</div>
74
+ <div style={styles.description}>{t('row.description')}</div>
75
+ <div style={styles.status}>{write === '' ? status : status + ' · ' + write}</div>
76
+ </div>
77
+ <div style={styles.controls}>
78
+ <div style={styles.times} title={t('row.timeHint')}>
79
+ <label style={styles.field}>
80
+ <span style={styles.fieldLabel}>{t('row.lightStart')}</span>
81
+ <input
82
+ type="time"
83
+ step={60}
84
+ value={config.lightStart}
85
+ aria-label={t('row.lightStart')}
86
+ onChange={event => changeTime('lightStart', event.currentTarget.value)}
87
+ style={styles.input}
88
+ />
89
+ </label>
90
+ <span style={styles.dash}>{t('row.dash')}</span>
91
+ <label style={styles.field}>
92
+ <span style={styles.fieldLabel}>{t('row.lightEnd')}</span>
93
+ <input
94
+ type="time"
95
+ step={60}
96
+ value={config.lightEnd}
97
+ aria-label={t('row.lightEnd')}
98
+ onChange={event => changeTime('lightEnd', event.currentTarget.value)}
99
+ style={styles.input}
100
+ />
101
+ </label>
102
+ </div>
103
+ <Switch
104
+ checked={config.enabled}
105
+ label={config.enabled ? t('row.disable') : t('row.enable')}
106
+ title={config.enabled ? t('row.disable') : t('row.enable')}
107
+ onChange={(next) => { toggle(next) }}
108
+ />
109
+ </div>
110
+ </div>
111
+ )
112
+ }