这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
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: 21 additions & 13 deletions frontends/search/src/components/ChunkMetadataDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { FullScreenModal } from "./Atoms/FullScreenModal";
import { DatasetAndUserContext } from "./Contexts/DatasetAndUserContext";
import { createToast } from "./ShowToasts";
import { Tooltip } from "shared/ui";
import { useLocation } from "@solidjs/router";

export const getLocalTime = (strDate: string | Date) => {
const utcDate = new Date(strDate);
Expand Down Expand Up @@ -66,6 +67,11 @@ const ChunkMetadataDisplay = (props: ChunkMetadataDisplayProps) => {
const [expandMetadata, setExpandMetadata] = createSignal(false);
const $currentDataset = datasetAndUserContext.currentDataset;

const location = useLocation();
const isInChunkViewer = createMemo(() => {
return location.pathname.startsWith("/chunk/");
});

const onDelete = () => {
if (props.signedInUserId !== props.viewingUserId) return;
const curChunkId = props.chunk.id;
Expand Down Expand Up @@ -145,19 +151,21 @@ const ChunkMetadataDisplay = (props: ChunkMetadataDisplayProps) => {
<FiEdit class="h-5 w-5" />
</a>
</Show>
<Tooltip
body={
<a
title="Open chunk to test recommendations for similar chunks"
href={`/chunk/${props.chunk.id}?dataset=${
$currentDataset?.()?.dataset.id ?? ""
}`}
>
<FiEye class="h-5 w-5" />
</a>
}
tooltipText="Open to test recommendations for similar chunks"
/>
<Show when={!isInChunkViewer()}>
<Tooltip
body={
<a
title="Open chunk to test recommendations for similar chunks"
href={`/chunk/${props.chunk.id}?dataset=${
$currentDataset?.()?.dataset.id ?? ""
}`}
>
<FiEye class="h-5 w-5" />
</a>
}
tooltipText="Open to test recommendations for similar chunks"
/>
</Show>

<BookmarkPopover
totalGroupPages={props.totalGroupPages}
Expand Down
35 changes: 21 additions & 14 deletions frontends/search/src/components/ScoreChunk.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import sanitizeHtml from "sanitize-html";
import { FiEdit, FiTrash } from "solid-icons/fi";
import { Tooltip } from "shared/ui";
import { FullScreenModal } from "./Atoms/FullScreenModal";
import { A } from "@solidjs/router";
import { A, useLocation } from "@solidjs/router";
import { DatasetAndUserContext } from "./Contexts/DatasetAndUserContext";

export const sanitzerOptions = {
Expand Down Expand Up @@ -108,6 +108,11 @@ const ScoreChunk = (props: ScoreChunkProps) => {
setShowPropsModal(false);
});

const location = useLocation();
const isInChunkViewer = createMemo(() => {
return location.pathname.startsWith("/chunk/");
});

const deleteChunk = () => {
if (!props.setOnDelete) return;
const dataset = $currentDataset?.();
Expand Down Expand Up @@ -242,19 +247,21 @@ const ScoreChunk = (props: ScoreChunkProps) => {
</Show>
<div class="flex-1" />

<Tooltip
body={
<A
href={`/chunk/${
props.chunk.id
}?dataset=${$currentDataset?.()?.dataset.id}`}
>
<FiEye class="h-5 w-5" />
</A>
}
tooltipText="Open chunk to test recommendations for similar chunks"
direction="left"
/>
<Show when={!isInChunkViewer()}>
<Tooltip
body={
<A
href={`/chunk/${
props.chunk.id
}?dataset=${$currentDataset?.()?.dataset.id}`}
>
<FiEye class="h-5 w-5" />
</A>
}
tooltipText="Open chunk to test recommendations for similar chunks"
direction="left"
/>
</Show>
<Show when={currentUserRole() > 0}>
<Tooltip
body={
Expand Down