Skip to content

Commit 205f18c

Browse files
authored
transcript editor analytics + new design (#1490)
* minor fixes * ran tests * more analytics * ran tests * coderabbit * ran tests
1 parent 9a6b543 commit 205f18c

File tree

5 files changed

+56
-21
lines changed

5 files changed

+56
-21
lines changed

apps/desktop/src/components/command-palette.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,8 @@ export function CommandPalette({ open, onOpenChange }: CommandPaletteProps) {
319319
const style = document.createElement("style");
320320
style.textContent = `
321321
[role="dialog"][aria-modal="true"] {
322-
width: 800px !important;
323-
max-width: 90vw !important;
322+
width: 590px !important;
323+
max-width: 80vw !important;
324324
}
325325
`;
326326
document.head.appendChild(style);

apps/desktop/src/components/editor-area/note-header/listen-button.tsx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { z } from "zod";
1818
import SoundIndicator from "@/components/sound-indicator";
1919
import { useHypr } from "@/contexts";
2020
import { useEnhancePendingState } from "@/hooks/enhance-pending";
21+
import { commands as analyticsCommands } from "@hypr/plugin-analytics";
2122
import { commands as dbCommands } from "@hypr/plugin-db";
2223
import { commands as listenerCommands } from "@hypr/plugin-listener";
2324
import { commands as localSttCommands } from "@hypr/plugin-local-stt";
@@ -49,7 +50,7 @@ const showConsentNotification = () => {
4950
};
5051

5152
export default function ListenButton({ sessionId, isCompact = false }: { sessionId: string; isCompact?: boolean }) {
52-
const { onboardingSessionId } = useHypr();
53+
const { onboardingSessionId, userId } = useHypr();
5354
const isOnboarding = sessionId === onboardingSessionId;
5455

5556
const ongoingSessionStatus = useOngoingSession((s) => s.status);
@@ -100,6 +101,14 @@ export default function ListenButton({ sessionId, isCompact = false }: { session
100101
if (isOnboarding) {
101102
listenerCommands.setMicMuted(true);
102103
}
104+
105+
if (!isOnboarding && userId) {
106+
analyticsCommands.event({
107+
event: "recording_start_session",
108+
distinct_id: userId,
109+
properties: { session_id: sessionId },
110+
});
111+
}
103112
}
104113
};
105114

@@ -234,6 +243,7 @@ function WhenInactiveAndMeetingEndedOnboarding({ disabled, onClick }: { disabled
234243
}
235244

236245
function WhenActive({ sessionId }: { sessionId: string }) {
246+
const { userId } = useHypr();
237247
const ongoingSessionId = useOngoingSession((s) => s.sessionId);
238248
const ongoingSessionStore = useOngoingSession((s) => ({
239249
stop: s.stop,
@@ -249,6 +259,14 @@ function WhenActive({ sessionId }: { sessionId: string }) {
249259
if (sessionWords.length === 0) {
250260
sonnerToast.dismiss("recording-consent-reminder");
251261
}
262+
263+
if (userId) {
264+
analyticsCommands.event({
265+
event: "recording_stop_session",
266+
distinct_id: userId,
267+
properties: { session_id: sessionId },
268+
});
269+
}
252270
};
253271

254272
return (

apps/desktop/src/components/right-panel/views/transcript-view.tsx

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
ChevronDownIcon,
1010
ClipboardIcon,
1111
CopyIcon,
12-
PencilIcon,
1312
TextSearchIcon,
1413
UploadIcon,
1514
} from "lucide-react";
@@ -18,6 +17,7 @@ import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
1817
import { ParticipantList } from "@/components/editor-area/note-header/chips/participants-chip";
1918
import { useHypr } from "@/contexts";
2019
import { useContainerWidth } from "@/hooks/use-container-width";
20+
import { commands as analyticsCommands } from "@hypr/plugin-analytics";
2121
import { commands as dbCommands, Human, Word2 } from "@hypr/plugin-db";
2222
import { commands as miscCommands } from "@hypr/plugin-misc";
2323
import TranscriptEditor, {
@@ -94,6 +94,7 @@ function RenderInMeeting({ words }: { words: Word2[] }) {
9494
}
9595

9696
function RenderNotInMeeting({ sessionId, words }: { sessionId: string; words: Word2[] }) {
97+
const { userId } = useHypr();
9798
const queryClient = useQueryClient();
9899

99100
const [editable, setEditable] = useState(false);
@@ -169,11 +170,18 @@ function RenderNotInMeeting({ sessionId, words }: { sessionId: string; words: Wo
169170
});
170171
}
171172
});
173+
} else {
174+
if (userId) {
175+
analyticsCommands.event({
176+
event: "transcript_toggle_edit",
177+
distinct_id: userId,
178+
});
179+
}
172180
}
173181

174182
return !v;
175183
});
176-
}, [editorWords]);
184+
}, [editorWords, userId]);
177185

178186
const handleUpdate = (words: Word2[]) => {
179187
setEditorWords(words);
@@ -214,14 +222,14 @@ function RenderNotInMeeting({ sessionId, words }: { sessionId: string; words: Wo
214222
const EditToggle = () => {
215223
return (
216224
<Button
217-
className="w-6 h-6"
225+
className="px-2 py-0.5 h-6 bg-neutral-50 hover:bg-neutral-100 border border-neutral-200"
218226
variant="ghost"
219-
size="icon"
227+
size="sm"
220228
onClick={handeToggleEdit}
221229
>
222-
{editable
223-
? <CheckIcon size={12} className="text-neutral-600" />
224-
: <PencilIcon size={12} className="text-neutral-600" />}
230+
<span className="text-2xs text-neutral-600 font-normal">
231+
{editable ? "Save" : "Edit"}
232+
</span>
225233
</Button>
226234
);
227235
};
@@ -231,7 +239,9 @@ function RenderNotInMeeting({ sessionId, words }: { sessionId: string; words: Wo
231239
<header className="flex items-center justify-between w-full px-4 py-1 my-1 border-b">
232240
<div className="flex items-center">
233241
<h2 className="text-sm font-semibold text-neutral-900">Transcript</h2>
234-
<EditToggle />
242+
<div className="ml-2">
243+
<EditToggle />
244+
</div>
235245
</div>
236246
<div className="not-draggable flex items-center">
237247
<Button
@@ -517,6 +527,13 @@ const MemoizedSpeakerSelector = memo(({
517527
onClick={() => {
518528
onSpeakerChange(candidate, speakerRange);
519529
setIsOpen(false);
530+
531+
if (userId) {
532+
analyticsCommands.event({
533+
event: "transcript_speaker_change",
534+
distinct_id: userId,
535+
});
536+
}
520537
}}
521538
>
522539
Apply Speaker Change

apps/desktop/src/locales/en/messages.po

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,9 @@ msgstr "(Optional)"
219219
#. placeholder {0}: disabled ? "Wait..." : "Play again"
220220
#. placeholder {0}: disabled ? "Wait..." : "Play video"
221221
#. placeholder {0}: disabled ? "Wait..." : isHovered ? (isCompact ? "Resume" : "Resume") : (isCompact ? "Ended" : "Ended")
222-
#: src/components/editor-area/note-header/listen-button.tsx:187
223-
#: src/components/editor-area/note-header/listen-button.tsx:211
224-
#: src/components/editor-area/note-header/listen-button.tsx:231
222+
#: src/components/editor-area/note-header/listen-button.tsx:196
223+
#: src/components/editor-area/note-header/listen-button.tsx:220
224+
#: src/components/editor-area/note-header/listen-button.tsx:240
225225
#: src/components/settings/views/templates.tsx:253
226226
msgid "{0}"
227227
msgstr "{0}"
@@ -1082,11 +1082,11 @@ msgstr "Spoken languages"
10821082
msgid "Start automatically at login"
10831083
msgstr "Start automatically at login"
10841084

1085-
#: src/components/editor-area/note-header/listen-button.tsx:158
1085+
#: src/components/editor-area/note-header/listen-button.tsx:167
10861086
msgid "Start recording"
10871087
msgstr "Start recording"
10881088

1089-
#: src/components/editor-area/note-header/listen-button.tsx:367
1089+
#: src/components/editor-area/note-header/listen-button.tsx:385
10901090
msgid "Stop"
10911091
msgstr "Stop"
10921092

apps/desktop/src/locales/ko/messages.po

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,9 @@ msgstr ""
219219
#. placeholder {0}: disabled ? "Wait..." : "Play again"
220220
#. placeholder {0}: disabled ? "Wait..." : "Play video"
221221
#. placeholder {0}: disabled ? "Wait..." : isHovered ? (isCompact ? "Resume" : "Resume") : (isCompact ? "Ended" : "Ended")
222-
#: src/components/editor-area/note-header/listen-button.tsx:187
223-
#: src/components/editor-area/note-header/listen-button.tsx:211
224-
#: src/components/editor-area/note-header/listen-button.tsx:231
222+
#: src/components/editor-area/note-header/listen-button.tsx:196
223+
#: src/components/editor-area/note-header/listen-button.tsx:220
224+
#: src/components/editor-area/note-header/listen-button.tsx:240
225225
#: src/components/settings/views/templates.tsx:253
226226
msgid "{0}"
227227
msgstr ""
@@ -1077,11 +1077,11 @@ msgstr ""
10771077
msgid "Start automatically at login"
10781078
msgstr ""
10791079

1080-
#: src/components/editor-area/note-header/listen-button.tsx:158
1080+
#: src/components/editor-area/note-header/listen-button.tsx:167
10811081
msgid "Start recording"
10821082
msgstr ""
10831083

1084-
#: src/components/editor-area/note-header/listen-button.tsx:367
1084+
#: src/components/editor-area/note-header/listen-button.tsx:385
10851085
msgid "Stop"
10861086
msgstr ""
10871087

0 commit comments

Comments
 (0)