chore: cancel exc /friend (no content)
Browse files- src/commands/friend/friend.tsx +19 -43
src/commands/friend/friend.tsx
CHANGED
|
@@ -4,13 +4,12 @@
|
|
| 4 |
* Ink-based terminal UI that shows status and controls for the
|
| 5 |
* Friend desktop pet feature.
|
| 6 |
*/
|
| 7 |
-
import React, {
|
| 8 |
import { Box, Text, useInput } from '../../ink.js'
|
| 9 |
import { getPrefs, updatePrefs } from '../../friend/prefs.js'
|
| 10 |
import {
|
| 11 |
launchTauri,
|
| 12 |
stopTauri,
|
| 13 |
-
getTauriProcess,
|
| 14 |
} from '../../friend/tauri-launcher.js'
|
| 15 |
import type { LocalJSXCommandOnDone, CommandResultDisplay } from '../../types/command.js'
|
| 16 |
|
|
@@ -21,8 +20,6 @@ const logger = () => ({
|
|
| 21 |
warn: (msg: string) => console.warn(`[Friend] ${msg}`),
|
| 22 |
})
|
| 23 |
|
| 24 |
-
type Page = 'status' | 'help'
|
| 25 |
-
|
| 26 |
export async function call(
|
| 27 |
onDone: (result?: string, options?: { display?: CommandResultDisplay }) => void,
|
| 28 |
_context: unknown,
|
|
@@ -42,20 +39,13 @@ export async function call(
|
|
| 42 |
return <FriendStopView onDone={onDone} />
|
| 43 |
}
|
| 44 |
|
| 45 |
-
if (trimmed === 'status') {
|
| 46 |
-
const prefs = getPrefs()
|
| 47 |
-
return <FriendStatus prefs={prefs} compact />
|
| 48 |
-
}
|
| 49 |
-
|
| 50 |
return <FriendManager onDone={onDone} />
|
| 51 |
}
|
| 52 |
|
| 53 |
function FriendManager({ onDone }: { onDone: LocalJSXCommandOnDone }) {
|
| 54 |
-
const [page, setPage] = useState<Page>('status')
|
| 55 |
-
|
| 56 |
useInput((_input, key) => {
|
| 57 |
if (key.escape || key.return) {
|
| 58 |
-
onDone()
|
| 59 |
}
|
| 60 |
})
|
| 61 |
|
|
@@ -67,14 +57,13 @@ function FriendManager({ onDone }: { onDone: LocalJSXCommandOnDone }) {
|
|
| 67 |
</Text>
|
| 68 |
</Box>
|
| 69 |
|
| 70 |
-
<FriendStatus prefs={getPrefs()}
|
| 71 |
|
| 72 |
<Box marginTop={1} flexDirection="column">
|
| 73 |
<Text dimColor>Usage:</Text>
|
| 74 |
<Text dimColor> /friend Interactive status & controls</Text>
|
| 75 |
<Text dimColor> /friend start Launch friend window</Text>
|
| 76 |
<Text dimColor> /friend stop Stop friend window</Text>
|
| 77 |
-
<Text dimColor> /friend status Quick status overview</Text>
|
| 78 |
</Box>
|
| 79 |
|
| 80 |
<Box marginTop={1}>
|
|
@@ -114,14 +103,11 @@ function FriendStartView({ onDone }: { onDone: LocalJSXCommandOnDone }) {
|
|
| 114 |
|
| 115 |
function FriendStatus({
|
| 116 |
prefs,
|
| 117 |
-
compact,
|
| 118 |
}: {
|
| 119 |
prefs: ReturnType<typeof getPrefs>
|
| 120 |
-
compact: boolean
|
| 121 |
}) {
|
| 122 |
const statusDot = prefs.enabled ? '●' : '○'
|
| 123 |
const statusColor = prefs.enabled ? 'green' : 'gray'
|
| 124 |
-
const running = !!getTauriProcess()
|
| 125 |
|
| 126 |
return (
|
| 127 |
<Box flexDirection="column">
|
|
@@ -131,32 +117,22 @@ function FriendStatus({
|
|
| 131 |
{prefs.enabled ? 'Enabled' : 'Disabled'}
|
| 132 |
</Text>
|
| 133 |
</Box>
|
| 134 |
-
|
| 135 |
-
<>
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
<Box>
|
| 151 |
-
<Text> TTS: </Text>
|
| 152 |
-
<Text dimColor>{prefs.ttsEnabled ? 'on' : 'off'}</Text>
|
| 153 |
-
</Box>
|
| 154 |
-
<Box>
|
| 155 |
-
<Text> Tracking: </Text>
|
| 156 |
-
<Text dimColor>{prefs.tracking ?? 'mouse'}</Text>
|
| 157 |
-
</Box>
|
| 158 |
-
</>
|
| 159 |
-
)}
|
| 160 |
</Box>
|
| 161 |
)
|
| 162 |
}
|
|
|
|
| 4 |
* Ink-based terminal UI that shows status and controls for the
|
| 5 |
* Friend desktop pet feature.
|
| 6 |
*/
|
| 7 |
+
import React, { useEffect } from 'react'
|
| 8 |
import { Box, Text, useInput } from '../../ink.js'
|
| 9 |
import { getPrefs, updatePrefs } from '../../friend/prefs.js'
|
| 10 |
import {
|
| 11 |
launchTauri,
|
| 12 |
stopTauri,
|
|
|
|
| 13 |
} from '../../friend/tauri-launcher.js'
|
| 14 |
import type { LocalJSXCommandOnDone, CommandResultDisplay } from '../../types/command.js'
|
| 15 |
|
|
|
|
| 20 |
warn: (msg: string) => console.warn(`[Friend] ${msg}`),
|
| 21 |
})
|
| 22 |
|
|
|
|
|
|
|
| 23 |
export async function call(
|
| 24 |
onDone: (result?: string, options?: { display?: CommandResultDisplay }) => void,
|
| 25 |
_context: unknown,
|
|
|
|
| 39 |
return <FriendStopView onDone={onDone} />
|
| 40 |
}
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
return <FriendManager onDone={onDone} />
|
| 43 |
}
|
| 44 |
|
| 45 |
function FriendManager({ onDone }: { onDone: LocalJSXCommandOnDone }) {
|
|
|
|
|
|
|
| 46 |
useInput((_input, key) => {
|
| 47 |
if (key.escape || key.return) {
|
| 48 |
+
onDone(undefined, { display: 'skip' })
|
| 49 |
}
|
| 50 |
})
|
| 51 |
|
|
|
|
| 57 |
</Text>
|
| 58 |
</Box>
|
| 59 |
|
| 60 |
+
<FriendStatus prefs={getPrefs()} />
|
| 61 |
|
| 62 |
<Box marginTop={1} flexDirection="column">
|
| 63 |
<Text dimColor>Usage:</Text>
|
| 64 |
<Text dimColor> /friend Interactive status & controls</Text>
|
| 65 |
<Text dimColor> /friend start Launch friend window</Text>
|
| 66 |
<Text dimColor> /friend stop Stop friend window</Text>
|
|
|
|
| 67 |
</Box>
|
| 68 |
|
| 69 |
<Box marginTop={1}>
|
|
|
|
| 103 |
|
| 104 |
function FriendStatus({
|
| 105 |
prefs,
|
|
|
|
| 106 |
}: {
|
| 107 |
prefs: ReturnType<typeof getPrefs>
|
|
|
|
| 108 |
}) {
|
| 109 |
const statusDot = prefs.enabled ? '●' : '○'
|
| 110 |
const statusColor = prefs.enabled ? 'green' : 'gray'
|
|
|
|
| 111 |
|
| 112 |
return (
|
| 113 |
<Box flexDirection="column">
|
|
|
|
| 117 |
{prefs.enabled ? 'Enabled' : 'Disabled'}
|
| 118 |
</Text>
|
| 119 |
</Box>
|
| 120 |
+
<Box>
|
| 121 |
+
<Text> URL: </Text>
|
| 122 |
+
<Text dimColor>{FRIEND_URL}</Text>
|
| 123 |
+
</Box>
|
| 124 |
+
<Box>
|
| 125 |
+
<Text> Voice: </Text>
|
| 126 |
+
<Text dimColor>{prefs.voice ?? 'default'}</Text>
|
| 127 |
+
</Box>
|
| 128 |
+
<Box>
|
| 129 |
+
<Text> TTS: </Text>
|
| 130 |
+
<Text dimColor>{prefs.ttsEnabled ? 'on' : 'off'}</Text>
|
| 131 |
+
</Box>
|
| 132 |
+
<Box>
|
| 133 |
+
<Text> Tracking: </Text>
|
| 134 |
+
<Text dimColor>{prefs.tracking ?? 'mouse'}</Text>
|
| 135 |
+
</Box>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
</Box>
|
| 137 |
)
|
| 138 |
}
|