Skip to content
Open
Changes from all commits
Commits
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
34 changes: 33 additions & 1 deletion apps/web/components/select-spaces-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ import {
Loader,
Pencil,
Check,
ExternalLink,
} from "lucide-react"
import { Tooltip, TooltipContent, TooltipTrigger } from "@ui/components/tooltip"
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"
import { toast } from "sonner"
import { DEFAULT_PROJECT_ID } from "@lib/constants"
Expand Down Expand Up @@ -90,6 +92,14 @@ type Category = {
count: number
}

const CONSOLE_PLAYGROUND_URL = "https://console.supermemory.ai/playground"
Comment thread
ved015 marked this conversation as resolved.

function openContainerTagInPlayground(containerTag: string) {
const url = new URL(CONSOLE_PLAYGROUND_URL)
url.searchParams.set("containerTag", containerTag)
window.open(url.toString(), "_blank", "noopener,noreferrer")
}

export function SelectSpacesModal({
isOpen,
onClose,
Expand Down Expand Up @@ -590,6 +600,7 @@ export function SelectSpacesModal({
const isOwnSpace = isOwnConversationSpace(project, user?.id)
const canEdit = !isDefault && !plugin && !isOwnSpace
const canBulkDelete = enableDelete && !isDefault
const canOpenPlayground = enableDelete
const isEditing = editingProject?.containerTag === project.containerTag
const isBulkDeleteSelected = bulkDeleteTags.has(project.containerTag)
const trimmedEditName = editingProject?.name.trim() ?? ""
Expand Down Expand Up @@ -755,6 +766,27 @@ export function SelectSpacesModal({
<Pencil className="size-3.5" />
</button>
)}
{canOpenPlayground && !isEditing && !isBulkDeleteMode && (
<Tooltip>
<TooltipTrigger asChild>
<button
type="button"
onClick={(e) => {
e.stopPropagation()
openContainerTagInPlayground(project.containerTag)
e.currentTarget.blur()
}}
aria-label="Open in Playground"
className="shrink-0 opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-opacity p-1.5 rounded-full text-[#737373] hover:bg-[#4BA0FA]/15 hover:text-[#4BA0FA] cursor-pointer focus:outline-none"
>
<ExternalLink className="size-3.5" />
</button>
</TooltipTrigger>
<TooltipContent side="right" className={dmSansClassName()}>
Open in Playground
</TooltipContent>
</Tooltip>
)}
{enableDelete &&
!isDefault &&
!isEditing &&
Expand All @@ -771,7 +803,7 @@ export function SelectSpacesModal({
})
}}
aria-label="Delete space"
className="shrink-0 opacity-0 group-hover:opacity-100 transition-opacity p-1.5 rounded-full hover:bg-red-500/15 cursor-pointer focus:outline-none"
className="-ml-2 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity p-1.5 rounded-full hover:bg-red-500/15 cursor-pointer focus:outline-none"
>
<Trash2 className="size-3.5 text-red-400" />
</button>
Expand Down
Loading