|
579 | 579 |
|
580 | 580 | <!-- svelte-ignore a11y-no-static-element-interactions --> |
581 | 581 | {#if !readonly} |
582 | | - <div |
583 | | - id="sidebar-chat-item-menu" |
584 | | - class=" |
| 582 | + <div |
| 583 | + id="sidebar-chat-item-menu" |
| 584 | + class=" |
585 | 585 | {id === $chatId || confirmEdit |
586 | | - ? 'from-gray-100 dark:from-gray-900 selected' |
587 | | - : selected |
588 | | - ? 'from-gray-100 dark:from-gray-950 selected' |
589 | | - : 'invisible group-hover:visible from-gray-100 dark:from-gray-950'} |
| 586 | + ? 'from-gray-100 dark:from-gray-900 selected' |
| 587 | + : selected |
| 588 | + ? 'from-gray-100 dark:from-gray-950 selected' |
| 589 | + : 'invisible group-hover:visible from-gray-100 dark:from-gray-950'} |
590 | 590 | absolute {className === 'pr-2' |
591 | | - ? 'right-[8px]' |
592 | | - : 'right-1'} top-[4px] py-1 pr-0.5 mr-1.5 pl-5 bg-linear-to-l from-80% |
| 591 | + ? 'right-[8px]' |
| 592 | + : 'right-1'} top-[4px] py-1 pr-0.5 mr-1.5 pl-5 bg-linear-to-l from-80% |
593 | 593 |
|
594 | 594 | to-transparent" |
595 | | - on:mouseenter={(e) => { |
596 | | - mouseOver = true; |
597 | | - }} |
598 | | - on:mouseleave={(e) => { |
599 | | - mouseOver = false; |
600 | | - }} |
601 | | - > |
602 | | - {#if confirmEdit} |
603 | | - <div |
604 | | - class="flex self-center items-center space-x-1.5 z-10 translate-y-[0.5px] -translate-x-[0.5px]" |
605 | | - > |
606 | | - <Tooltip content={$i18n.t('Generate')}> |
607 | | - <button |
608 | | - class=" self-center dark:hover:text-white transition disabled:cursor-not-allowed" |
609 | | - id="generate-title-button" |
610 | | - disabled={generating} |
611 | | - on:click={() => { |
612 | | - generateTitleHandler(); |
| 595 | + on:mouseenter={(e) => { |
| 596 | + mouseOver = true; |
| 597 | + }} |
| 598 | + on:mouseleave={(e) => { |
| 599 | + mouseOver = false; |
| 600 | + }} |
| 601 | + > |
| 602 | + {#if confirmEdit} |
| 603 | + <div |
| 604 | + class="flex self-center items-center space-x-1.5 z-10 translate-y-[0.5px] -translate-x-[0.5px]" |
| 605 | + > |
| 606 | + <Tooltip content={$i18n.t('Generate')}> |
| 607 | + <button |
| 608 | + class=" self-center dark:hover:text-white transition disabled:cursor-not-allowed" |
| 609 | + id="generate-title-button" |
| 610 | + disabled={generating} |
| 611 | + on:click={() => { |
| 612 | + generateTitleHandler(); |
| 613 | + }} |
| 614 | + > |
| 615 | + <Sparkles strokeWidth="2" /> |
| 616 | + </button> |
| 617 | + </Tooltip> |
| 618 | + </div> |
| 619 | + {:else if shiftKey && mouseOver} |
| 620 | + <div class=" flex items-center self-center space-x-1.5"> |
| 621 | + <Tooltip content={$i18n.t('Archive')} className="flex items-center"> |
| 622 | + <button |
| 623 | + class=" self-center dark:hover:text-white transition disabled:cursor-not-allowed" |
| 624 | + disabled={archiving} |
| 625 | + on:click={() => { |
| 626 | + archiveChatHandler(id); |
| 627 | + }} |
| 628 | + type="button" |
| 629 | + > |
| 630 | + <ArchiveBox className="size-4 translate-y-[0.5px]" strokeWidth="2" /> |
| 631 | + </button> |
| 632 | + </Tooltip> |
| 633 | + |
| 634 | + <Tooltip content={$i18n.t('Delete')}> |
| 635 | + <button |
| 636 | + class=" self-center dark:hover:text-white transition disabled:cursor-not-allowed" |
| 637 | + disabled={deleting} |
| 638 | + on:click={() => { |
| 639 | + deleteChatHandler(id); |
| 640 | + }} |
| 641 | + type="button" |
| 642 | + > |
| 643 | + <GarbageBin strokeWidth="2" /> |
| 644 | + </button> |
| 645 | + </Tooltip> |
| 646 | + </div> |
| 647 | + {:else} |
| 648 | + <div class="flex self-center z-10 items-end"> |
| 649 | + <ChatMenu |
| 650 | + chatId={id} |
| 651 | + cloneChatHandler={() => { |
| 652 | + cloneChatHandler(id); |
613 | 653 | }} |
614 | | - > |
615 | | - <Sparkles strokeWidth="2" /> |
616 | | - </button> |
617 | | - </Tooltip> |
618 | | - </div> |
619 | | - {:else if shiftKey && mouseOver} |
620 | | - <div class=" flex items-center self-center space-x-1.5"> |
621 | | - <Tooltip content={$i18n.t('Archive')} className="flex items-center"> |
622 | | - <button |
623 | | - class=" self-center dark:hover:text-white transition disabled:cursor-not-allowed" |
624 | | - disabled={archiving} |
625 | | - on:click={() => { |
| 654 | + shareHandler={() => { |
| 655 | + showShareChatModal = true; |
| 656 | + }} |
| 657 | + {moveChatHandler} |
| 658 | + archiveChatHandler={() => { |
626 | 659 | archiveChatHandler(id); |
627 | 660 | }} |
628 | | - type="button" |
629 | | - > |
630 | | - <ArchiveBox className="size-4 translate-y-[0.5px]" strokeWidth="2" /> |
631 | | - </button> |
632 | | - </Tooltip> |
633 | | - |
634 | | - <Tooltip content={$i18n.t('Delete')}> |
635 | | - <button |
636 | | - class=" self-center dark:hover:text-white transition disabled:cursor-not-allowed" |
637 | | - disabled={deleting} |
638 | | - on:click={() => { |
639 | | - deleteChatHandler(id); |
| 661 | + {renameHandler} |
| 662 | + deleteHandler={() => { |
| 663 | + showDeleteConfirm = true; |
640 | 664 | }} |
641 | | - type="button" |
642 | | - > |
643 | | - <GarbageBin strokeWidth="2" /> |
644 | | - </button> |
645 | | - </Tooltip> |
646 | | - </div> |
647 | | - {:else} |
648 | | - <div class="flex self-center z-10 items-end"> |
649 | | - <ChatMenu |
650 | | - chatId={id} |
651 | | - cloneChatHandler={() => { |
652 | | - cloneChatHandler(id); |
653 | | - }} |
654 | | - shareHandler={() => { |
655 | | - showShareChatModal = true; |
656 | | - }} |
657 | | - {moveChatHandler} |
658 | | - archiveChatHandler={() => { |
659 | | - archiveChatHandler(id); |
660 | | - }} |
661 | | - {renameHandler} |
662 | | - deleteHandler={() => { |
663 | | - showDeleteConfirm = true; |
664 | | - }} |
665 | | - onClose={() => { |
666 | | - dispatch('unselect'); |
667 | | - }} |
668 | | - onPinChange={async () => { |
669 | | - dispatch('change'); |
670 | | - }} |
671 | | - > |
672 | | - <button |
673 | | - aria-label="Chat Menu" |
674 | | - class=" self-center dark:hover:text-white transition m-0" |
675 | | - on:click={() => { |
676 | | - dispatch('select'); |
| 665 | + onClose={() => { |
| 666 | + dispatch('unselect'); |
677 | 667 | }} |
678 | | - > |
679 | | - <svg |
680 | | - xmlns="http://www.w3.org/2000/svg" |
681 | | - viewBox="0 0 16 16" |
682 | | - fill="currentColor" |
683 | | - class="w-4 h-4" |
684 | | - > |
685 | | - <path |
686 | | - d="M2 8a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM6.5 8a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM12.5 6.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3Z" |
687 | | - /> |
688 | | - </svg> |
689 | | - </button> |
690 | | - </ChatMenu> |
691 | | - |
692 | | - {#if id === $chatId} |
693 | | - <!-- Shortcut support using "delete-chat-button" id --> |
694 | | - <button |
695 | | - id="delete-chat-button" |
696 | | - class="hidden" |
697 | | - on:click={() => { |
698 | | - showDeleteConfirm = true; |
| 668 | + onPinChange={async () => { |
| 669 | + dispatch('change'); |
699 | 670 | }} |
700 | 671 | > |
701 | | - <svg |
702 | | - xmlns="http://www.w3.org/2000/svg" |
703 | | - viewBox="0 0 16 16" |
704 | | - fill="currentColor" |
705 | | - class="w-4 h-4" |
| 672 | + <button |
| 673 | + aria-label="Chat Menu" |
| 674 | + class=" self-center dark:hover:text-white transition m-0" |
| 675 | + on:click={() => { |
| 676 | + dispatch('select'); |
| 677 | + }} |
706 | 678 | > |
707 | | - <path |
708 | | - d="M2 8a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM6.5 8a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM12.5 6.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3Z" |
709 | | - /> |
710 | | - </svg> |
711 | | - </button> |
712 | | - {/if} |
713 | | - </div> |
714 | | - {/if} |
715 | | - </div> |
| 679 | + <svg |
| 680 | + xmlns="http://www.w3.org/2000/svg" |
| 681 | + viewBox="0 0 16 16" |
| 682 | + fill="currentColor" |
| 683 | + class="w-4 h-4" |
| 684 | + > |
| 685 | + <path |
| 686 | + d="M2 8a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM6.5 8a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM12.5 6.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3Z" |
| 687 | + /> |
| 688 | + </svg> |
| 689 | + </button> |
| 690 | + </ChatMenu> |
| 691 | + |
| 692 | + {#if id === $chatId} |
| 693 | + <!-- Shortcut support using "delete-chat-button" id --> |
| 694 | + <button |
| 695 | + id="delete-chat-button" |
| 696 | + class="hidden" |
| 697 | + on:click={() => { |
| 698 | + showDeleteConfirm = true; |
| 699 | + }} |
| 700 | + > |
| 701 | + <svg |
| 702 | + xmlns="http://www.w3.org/2000/svg" |
| 703 | + viewBox="0 0 16 16" |
| 704 | + fill="currentColor" |
| 705 | + class="w-4 h-4" |
| 706 | + > |
| 707 | + <path |
| 708 | + d="M2 8a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM6.5 8a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM12.5 6.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3Z" |
| 709 | + /> |
| 710 | + </svg> |
| 711 | + </button> |
| 712 | + {/if} |
| 713 | + </div> |
| 714 | + {/if} |
| 715 | + </div> |
716 | 716 | {/if} |
717 | 717 | </div> |
0 commit comments