Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: include latest transformationRun in recordings view #432

Merged
merged 73 commits into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
85093d3
feat: make ping permanent
braden-w Jan 18, 2025
7af5e36
feat: scaffold db queries for getting transformationRuns by recordingId
braden-w Jan 18, 2025
88dad4d
feat: scaffold ViewTransformationRunsDialog
braden-w Jan 18, 2025
d0de3b9
refactor: move transformationsQuery
braden-w Jan 19, 2025
854a712
refactor: rename to transformationRunsByIdQuery
braden-w Jan 19, 2025
b0c15c8
feat: hide ping if has selectedTransformation
braden-w Jan 21, 2025
379956d
refactor: useTransformationRunsByTransformationIdQuery
braden-w Jan 21, 2025
f6b04b0
feat: useLatestTransformationRunByTransformationIdQuery
braden-w Jan 21, 2025
7dbac85
refactor: formatting and id() and queryKey
braden-w Jan 21, 2025
df346ac
feat: sort getTransformationRunsByTransformationId
braden-w Jan 21, 2025
c3315bc
feat: sort by startedAt when getting transformationRuns
braden-w Jan 21, 2025
838ceef
feat: more detailed error message handled by DbServiceError
braden-w Jan 21, 2025
fa05974
fix: add description t ype
braden-w Jan 21, 2025
93a89f5
feat: useLatestTransformationRunByRecordingIdQuery
braden-w Jan 21, 2025
1d60e85
feat: ViewTransformationRuns with a window to open a popover
braden-w Jan 21, 2025
765a777
refactor: rename to transformationRunsByRecordingIdQuery
braden-w Jan 23, 2025
94ac862
wip feat: formatting ViewTransformationRunsDialog
braden-w Jan 23, 2025
44bf893
feat: TranscribedText dialog styling
braden-w Jan 23, 2025
6bd2ef0
feat: update props to accept runs rather than id
braden-w Jan 23, 2025
90cfb3b
chore: simplify and remove the query for getting the latest one, move…
braden-w Jan 23, 2025
319f13a
feat: Copyable variants
braden-w Jan 23, 2025
b6583b8
refactor: rename to copyableText
braden-w Jan 23, 2025
fe0a7d1
fix: imports
braden-w Jan 24, 2025
490fb47
formatting
braden-w Jan 24, 2025
3d71933
feat: add max-h-[90vh] overflow-y-auto
braden-w Jan 24, 2025
b723c74
chore: remove redundant classes
braden-w Jan 24, 2025
6da6a26
refactor: CopyToClipboardButton, with type for label
braden-w Jan 24, 2025
c3dbd82
refactor: CopyToClipboardbutton
braden-w Jan 24, 2025
af870a0
feat: no need for cn in CopyToClipboardButton
braden-w Jan 24, 2025
3703e87
wip feat: popover for displaying transcribedText
braden-w Jan 25, 2025
9967caf
refactor: props for TranscribedText
braden-w Jan 25, 2025
8f1f660
feat: make it a history icon again
braden-w Jan 25, 2025
e146c65
wip feat: table shares CopyableTextPopover
braden-w Jan 25, 2025
6a1b378
feat: simplify template of ViewTransformationRunsDialog to just use i…
braden-w Jan 25, 2025
3c916a5
chore: remove redundant sr-only
braden-w Jan 25, 2025
17ed4a1
feat: updates to template in TranscribedText.svelte
braden-w Jan 25, 2025
92aa91e
chore: variant=text
braden-w Jan 25, 2025
44c9eb1
refactor: use ClipboardIcon
braden-w Jan 25, 2025
826f993
fix: back to CopyIcon for duplicate
braden-w Jan 25, 2025
6e89312
feat: ClipboardIcon
braden-w Jan 25, 2025
d47de2b
feat: w-full no max-w for CopyableTextPopover
braden-w Jan 25, 2025
a074ff8
feat: use variant ghost and size icon
braden-w Jan 25, 2025
ece9c4a
feat: Row Actions updated to remove some buttons in favor of other co…
braden-w Jan 25, 2025
7a33c3c
Revert "feat: Row Actions updated to remove some buttons in favor of …
braden-w Jan 25, 2025
af85c8d
feat: as const
braden-w Jan 25, 2025
c046f49
feat: more possible labels for copying
braden-w Jan 25, 2025
b2c6819
feat: use CopyToClipboardButton, simplify view transitions
braden-w Jan 25, 2025
0941675
feat: add two copy to clipboard buttons
braden-w Jan 25, 2025
ec46b8b
feat: support Clipboard Icon for actions
braden-w Jan 25, 2025
df710da
feat: simplify just to use LayersIcon
braden-w Jan 25, 2025
1e5256d
feat: slot for custom copyIcon
braden-w Jan 25, 2025
1c728ff
feat: order of row actions
braden-w Jan 25, 2025
6cd138b
chore: organize imports
braden-w Jan 25, 2025
2cd4e0a
feat: standardize and simplify CopyableTextPopover usage
braden-w Jan 25, 2025
356aee4
refactor: move to copyable folder
braden-w Jan 25, 2025
262c58e
fix: imports
braden-w Jan 25, 2025
7bca595
refactor: CopyableTextPopover to CopyableTextDialog
braden-w Jan 25, 2025
09eda52
feat: convert from popover to dialog
braden-w Jan 25, 2025
27a475a
wip feat: try using textarea that is scrollable
braden-w Jan 25, 2025
4a9ca9f
refactor: WhisperingTooltip extracted
braden-w Jan 25, 2025
4016564
feat: use textarea for trigger of dialog
braden-w Jan 25, 2025
d94a939
feat: hover text point
braden-w Jan 25, 2025
3550887
feat: width of dialog and textarea with height for detail display
braden-w Jan 25, 2025
38d2a54
feat: textarea rows and styling
braden-w Jan 25, 2025
f83bc84
feat: propertyName has latestTransformationRunOutput
braden-w Jan 25, 2025
41f647f
feat: pass in id
braden-w Jan 25, 2025
9366217
refactor: getRecordingTransitionId
braden-w Jan 25, 2025
2a1b750
chore: restore ordering of buttons in dialog-footer
braden-w Jan 25, 2025
c5160be
feat: useLatestTransformationRunByRecordingIdQuery and pending states
braden-w Jan 25, 2025
0f78557
feat: : pass through class prop
braden-w Jan 25, 2025
046bca3
refactor: remove buttonViewTransitionName
braden-w Jan 26, 2025
ea2f9b5
feat: getTransformationRunTransitionId
braden-w Jan 26, 2025
536ad11
refactor: stepRunId
braden-w Jan 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 0 additions & 77 deletions apps/app/src/lib/components/CopyableCode.svelte

This file was deleted.

44 changes: 15 additions & 29 deletions apps/app/src/lib/components/WhisperingButton.svelte
Original file line number Diff line number Diff line change
@@ -1,39 +1,25 @@
<script lang="ts">
import { Button, type Props } from '$lib/components/ui/button/index.js';
import * as Tooltip from '$lib/components/ui/tooltip/index.js';
import { mergeProps } from 'bits-ui';
import type { Snippet } from 'svelte';
import WhisperingTooltip from './WhisperingTooltip.svelte';
import { nanoid } from 'nanoid/non-secure';

let {
id,
id = nanoid(),
children,
tooltipContent,
...restProps
}: { id?: string; tooltipContent: string | Snippet } & Props = $props();
...buttonProps
}: Props & { id?: string; tooltipContent: string | Snippet } = $props();
</script>

{#snippet tooltip()}
{#if typeof tooltipContent === 'string'}
{tooltipContent}
{:else}
{@render tooltipContent()}
{/if}
{/snippet}

<Tooltip.Provider>
<Tooltip.Root>
<Tooltip.Trigger {id}>
{#snippet child({ props: tooltipProps })}
<Button {...mergeProps(tooltipProps, restProps)}>
{@render children?.()}
<span class="sr-only">
{@render tooltip()}
</span>
</Button>
{/snippet}
</Tooltip.Trigger>
<Tooltip.Content class="max-w-xs text-center">
{@render tooltip()}
</Tooltip.Content>
</Tooltip.Root>
</Tooltip.Provider>
<WhisperingTooltip {id} {tooltipContent}>
{#snippet trigger({ tooltipProps, tooltip })}
<Button {...mergeProps(tooltipProps, buttonProps)}>
{@render children?.()}
<span class="sr-only">
{@render tooltip()}
</span>
</Button>
{/snippet}
</WhisperingTooltip>
42 changes: 42 additions & 0 deletions apps/app/src/lib/components/WhisperingTooltip.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<script lang="ts">
import * as Tooltip from '$lib/components/ui/tooltip/index.js';
import { mergeProps } from 'bits-ui';
import type { Snippet } from 'svelte';

let {
id,
trigger,
tooltipContent,
...restProps
}: {
id: string;
trigger: Snippet<
[{ tooltipProps: Record<string, unknown>; tooltip: Snippet<[]> }]
>;
tooltipContent: string | Snippet;
} = $props();
</script>

{#snippet tooltip()}
{#if typeof tooltipContent === 'string'}
{tooltipContent}
{:else}
{@render tooltipContent()}
{/if}
{/snippet}

<Tooltip.Provider>
<Tooltip.Root>
<Tooltip.Trigger {id}>
{#snippet child({ props: tooltipProps })}
{@render trigger?.({
tooltipProps: mergeProps(tooltipProps, restProps),
tooltip,
})}
{/snippet}
</Tooltip.Trigger>
<Tooltip.Content class="max-w-xs text-center">
{@render tooltip()}
</Tooltip.Content>
</Tooltip.Root>
</Tooltip.Provider>
67 changes: 67 additions & 0 deletions apps/app/src/lib/components/copyable/CopyToClipboardButton.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<script lang="ts">
import WhisperingButton from '$lib/components/WhisperingButton.svelte';
import { ClipboardIcon } from '$lib/components/icons';
import {
type CopyToClipboardLabel,
useCopyTextToClipboardWithToast,
} from '$lib/query/clipboard/mutations';
import { CheckIcon } from 'lucide-svelte';
import type { Snippet } from 'svelte';
import type { Props } from '$lib/components/ui/button';

const copyTextToClipboardWithToast = useCopyTextToClipboardWithToast();

let {
label,
copyableText,
viewTransitionName,
copyIcon: providedCopyIcon,
class: className,
}: {
label: CopyToClipboardLabel;
copyableText: string;
viewTransitionName?: string;
copyIcon?: Snippet;
class?: string;
} = $props();

let hasCopied = $state(false);

$effect(() => {
if (hasCopied) {
setTimeout(() => {
hasCopied = false;
}, 2000);
}
});
</script>

<WhisperingButton
tooltipContent="Copy {label} to clipboard"
size="icon"
variant="ghost"
onclick={() =>
copyTextToClipboardWithToast.mutate(
{ label, text: copyableText },
{ onSuccess: () => (hasCopied = true) },
)}
style={viewTransitionName
? `view-transition-name: ${viewTransitionName};`
: undefined}
class={className}
>
<span class="sr-only">Copy</span>
{#if hasCopied}
<CheckIcon />
{:else}
{@render copyIcon()}
{/if}
</WhisperingButton>

{#snippet copyIcon()}
{#if providedCopyIcon}
{@render providedCopyIcon()}
{:else}
<ClipboardIcon />
{/if}
{/snippet}
49 changes: 49 additions & 0 deletions apps/app/src/lib/components/copyable/Copyable.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<script lang="ts" module>
import { type VariantProps, tv } from 'tailwind-variants';

export const copyableVariants = tv({
base: 'relative whitespace-normal rounded p-4 pr-12 text-sm',
variants: {
variant: {
code: 'bg-muted text-muted-foreground font-semibold font-mono',
text: 'bg-muted text-muted-foreground',
error: 'bg-destructive/10 text-destructive',
},
},
});

export type CopyableVariants = VariantProps<
typeof copyableVariants
>['variant'];
</script>

<script lang="ts">
import { cn } from '$lib/utils';
import CopyToClipboardButton from './CopyToClipboardButton.svelte';
import { Label } from '../ui/label';

const {
label,
hideLabel,
copyableText,
variant,
}: {
label: string;
hideLabel?: boolean;
copyableText: string;
variant: CopyableVariants;
} = $props();
</script>

<div class="flex flex-col gap-2">
<Label class={cn('text-sm', hideLabel && 'sr-only')}>
{label}
</Label>
<pre class={copyableVariants({ variant })}>
{copyableText}
<CopyToClipboardButton
class="absolute right-4 top-4"
label={variant === 'code' ? 'code' : 'transcribed text'}
{copyableText}></CopyToClipboardButton>
</pre>
</div>
70 changes: 70 additions & 0 deletions apps/app/src/lib/components/copyable/CopyableTextDialog.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<script lang="ts">
import { ClipboardIcon } from '$lib/components/icons';
import { Button } from '$lib/components/ui/button';
import * as Card from '$lib/components/ui/card';
import * as Dialog from '$lib/components/ui/dialog';
import { Textarea } from '$lib/components/ui/textarea';
import { useCopyTextToClipboardWithToast } from '$lib/query/clipboard/mutations';
import { mergeProps } from 'bits-ui';
import WhisperingTooltip from '../WhisperingTooltip.svelte';

const copyTextToClipboardWithToast = useCopyTextToClipboardWithToast();

let {
id,
text,
}: {
id: string;
text: string;
} = $props();

let isDialogOpen = $state(false);
</script>

{#if text}
<Dialog.Root bind:open={isDialogOpen}>
<Dialog.Trigger {id}>
{#snippet child({ props: dialogTriggerProps })}
<WhisperingTooltip {id} tooltipContent="View Transcribed Text">
{#snippet trigger({ tooltipProps, tooltip })}
<Textarea
{...mergeProps(tooltipProps, dialogTriggerProps)}
class="h-full resize-none text-wrap text-left text-sm leading-snug hover:cursor-pointer hover:bg-accent hover:text-accent-foreground"
readonly
value={text}
style="view-transition-name: {id}"
rows={3}
/>
<span class="sr-only">
{@render tooltip()}
</span>
{/snippet}
</WhisperingTooltip>
{/snippet}
</Dialog.Trigger>
<Dialog.Content class="max-w-4xl">
<Card.Title class="text-lg">Transcribed Text</Card.Title>
<Textarea readonly value={text} rows={20} />
<Dialog.Footer>
<Button variant="outline" onclick={() => (isDialogOpen = false)}>
Close
</Button>
<Button
variant="outline"
onclick={() => {
copyTextToClipboardWithToast.mutate(
{
label: 'transcribed text',
text: text,
},
{ onSuccess: () => (isDialogOpen = false) },
);
}}
>
<ClipboardIcon class="h-4 w-4" />
Copy Text
</Button>
</Dialog.Footer>
</Dialog.Content>
</Dialog.Root>
{/if}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<DialogPrimitive.Content
bind:ref
class={cn(
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] bg-background fixed left-[50%] top-[50%] z-10 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg',
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] bg-background fixed left-[50%] top-[50%] z-10 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg max-h-[90vh] overflow-y-auto',
className,
)}
{...restProps}
Expand Down
2 changes: 1 addition & 1 deletion apps/app/src/lib/components/ui/dialog/dialog-footer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<div
bind:this={ref}
class={cn(
'flex flex-col-reverse sm:flex-row sm:justify-between gap-2',
'flex flex-col-reverse sm:flex-row sm:justify-end gap-2',
className,
)}
{...restProps}
Expand Down
Loading