mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-15 01:21:48 +03:00
feat(frontend): add logo to source when integration (#2899)
# Description Please include a summary of the changes and the related issue. Please also include relevant motivation and context. ## Checklist before requesting a review Please delete options that are not relevant. - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented hard-to-understand areas - [ ] I have ideally added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged ## Screenshots (if appropriate):
This commit is contained in:
parent
61bb7b2e02
commit
feb084ee39
@ -3,6 +3,7 @@ import React, { useEffect, useState } from "react";
|
||||
import { useChatInput } from "@/app/chat/[chatId]/components/ActionsBar/components/ChatInput/hooks/useChatInput";
|
||||
import { useChat } from "@/app/chat/[chatId]/hooks/useChat";
|
||||
import { useChatApi } from "@/lib/api/chat/useChatApi";
|
||||
import { Integration } from "@/lib/api/sync/types";
|
||||
import { CopyButton } from "@/lib/components/ui/CopyButton";
|
||||
import { Icon } from "@/lib/components/ui/Icon/Icon";
|
||||
import { Source } from "@/lib/types/MessageMetadata";
|
||||
@ -66,6 +67,8 @@ export const MessageRow = ({
|
||||
file_url: source.source_url,
|
||||
citations: [source.citation],
|
||||
selected: false,
|
||||
integration: source.integration as Integration,
|
||||
integration_link: source.integration_link,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
import Image from "next/image";
|
||||
import { useState } from "react";
|
||||
|
||||
import { useSync } from "@/lib/api/sync/useSync";
|
||||
import { Icon } from "@/lib/components/ui/Icon/Icon";
|
||||
import Tooltip from "@/lib/components/ui/Tooltip/Tooltip";
|
||||
|
||||
@ -17,6 +19,7 @@ export const SourceCitations = ({ sourceFile }: SourceProps): JSX.Element => {
|
||||
const [isCitationModalOpened, setIsCitationModalOpened] =
|
||||
useState<boolean>(false);
|
||||
const [citationIndex, setCitationIndex] = useState<number>(0);
|
||||
const { integrationIconUrls } = useSync();
|
||||
|
||||
return (
|
||||
<div>
|
||||
@ -29,17 +32,30 @@ export const SourceCitations = ({ sourceFile }: SourceProps): JSX.Element => {
|
||||
>
|
||||
<a
|
||||
onClick={(event) => event.stopPropagation()}
|
||||
href={sourceFile.file_url}
|
||||
href={
|
||||
sourceFile.integration_link
|
||||
? sourceFile.integration_link
|
||||
: sourceFile.file_url
|
||||
}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<div className={styles.source_header}>
|
||||
<span className={styles.filename}>{sourceFile.filename}</span>
|
||||
<Icon
|
||||
name="externLink"
|
||||
size="small"
|
||||
color={hovered ? "primary" : "black"}
|
||||
/>
|
||||
{sourceFile.integration ? (
|
||||
<Image
|
||||
src={integrationIconUrls[sourceFile.integration]}
|
||||
width="16"
|
||||
height="16"
|
||||
alt="integration_icon"
|
||||
/>
|
||||
) : (
|
||||
<Icon
|
||||
name="externLink"
|
||||
size="small"
|
||||
color={hovered ? "primary" : "black"}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
@ -1,6 +1,10 @@
|
||||
import { Integration } from "@/lib/api/sync/types";
|
||||
|
||||
export interface SourceFile {
|
||||
filename: string;
|
||||
file_url: string;
|
||||
citations: string[];
|
||||
selected: boolean;
|
||||
integration?: Integration;
|
||||
integration_link?: string;
|
||||
}
|
||||
|
@ -5,4 +5,6 @@ export interface Source {
|
||||
source_url: string;
|
||||
type: string;
|
||||
thoughts: string;
|
||||
integration?: string;
|
||||
integration_link?: string;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user