DialogConversationTitleUpdate.svelte 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <script lang="ts">
  2. import * as AlertDialog from '$lib/components/ui/alert-dialog';
  3. import { Button } from '$lib/components/ui/button';
  4. interface Props {
  5. open: boolean;
  6. currentTitle: string;
  7. newTitle: string;
  8. onConfirm: () => void;
  9. onCancel: () => void;
  10. }
  11. let { open = $bindable(), currentTitle, newTitle, onConfirm, onCancel }: Props = $props();
  12. </script>
  13. <AlertDialog.Root bind:open>
  14. <AlertDialog.Content>
  15. <AlertDialog.Header>
  16. <AlertDialog.Title>Update Conversation Title?</AlertDialog.Title>
  17. <AlertDialog.Description>
  18. Do you want to update the conversation title to match the first message content?
  19. </AlertDialog.Description>
  20. </AlertDialog.Header>
  21. <div class="space-y-4 pt-2 pb-6">
  22. <div class="space-y-2">
  23. <p class="text-sm font-medium text-muted-foreground">Current title:</p>
  24. <p class="rounded-md bg-muted/50 p-3 text-sm font-medium">{currentTitle}</p>
  25. </div>
  26. <div class="space-y-2">
  27. <p class="text-sm font-medium text-muted-foreground">New title would be:</p>
  28. <p class="rounded-md bg-muted/50 p-3 text-sm font-medium">{newTitle}</p>
  29. </div>
  30. </div>
  31. <AlertDialog.Footer>
  32. <Button variant="outline" onclick={onCancel}>Keep Current Title</Button>
  33. <Button onclick={onConfirm}>Update Title</Button>
  34. </AlertDialog.Footer>
  35. </AlertDialog.Content>
  36. </AlertDialog.Root>