Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
7 changes: 3 additions & 4 deletions frontend/src/components/CitationPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export const CitationPreview: React.FC<CitationPreviewProps> = React.memo(
citation.itemId &&
citation.clId
) {
const response = await api.cl[citation.clId].files[citation.itemId].content.$get()
const response =
await api.cl[citation.clId].files[citation.itemId].content.$get()

if (!response.ok) {
throw new Error(
Expand Down Expand Up @@ -232,9 +233,7 @@ export const CitationPreview: React.FC<CitationPreviewProps> = React.memo(
)}

{!loading && !error && documentContent && (
<div className="h-full overflow-auto">
{renderViewer()}
</div>
<div className="h-full overflow-auto">{renderViewer()}</div>
)}
</div>
</div>
Expand Down
15 changes: 12 additions & 3 deletions frontend/src/components/ClFileUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,24 @@ const CollectionFileUpload = ({
isFile: boolean
isDirectory: boolean
name: string
file?: (success: (file: File) => void, error: (err: Error) => void) => void
file?: (
success: (file: File) => void,
error: (err: Error) => void,
) => void
createReader?: () => FileSystemDirectoryReader
}

interface FileSystemDirectoryReader {
readEntries: (success: (entries: FileSystemEntry[]) => void, error: (err: Error) => void) => void
readEntries: (
success: (entries: FileSystemEntry[]) => void,
error: (err: Error) => void,
) => void
}

const traverseFileTree = (entry: FileSystemEntry, path: string): Promise<File[]> => {
const traverseFileTree = (
entry: FileSystemEntry,
path: string,
): Promise<File[]> => {
return new Promise((resolve, reject) => {
if (entry.isFile) {
entry.file?.(
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3604,7 +3604,9 @@ export const Dashboard = ({
<div className="p-6 space-y-6 max-w-7xl mx-auto">
<div className="flex items-center justify-between">
<div>
<h1 className="text-3xl tracking-wider font-display ">Dashboard</h1>
<h1 className="text-3xl tracking-wider font-display ">
Dashboard
</h1>
<p className="text-muted-foreground">
Monitor your Xyne chat activity and agent usage
</p>
Expand Down
90 changes: 46 additions & 44 deletions frontend/src/components/DocxViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,62 +157,62 @@ export const DocxViewer: React.FC<DocxViewerProps> = ({
if (containerRef.current) {
// Remove width constraints from all sections
const sections = containerRef.current.querySelectorAll(
'section.docx-preview, section.docx-viewer'
);
"section.docx-preview, section.docx-viewer",
)
sections.forEach((el) => {
const section = el as HTMLElement;
section.style.removeProperty('width');
section.style.removeProperty('max-width');
section.style.removeProperty('min-width');
section.style.width = '100%';
section.style.maxWidth = '100%';
section.style.minWidth = 'auto';
});
const section = el as HTMLElement
section.style.removeProperty("width")
section.style.removeProperty("max-width")
section.style.removeProperty("min-width")
section.style.width = "100%"
section.style.maxWidth = "100%"
section.style.minWidth = "auto"
})

// Remove width constraints from all wrappers
const wrappers = containerRef.current.querySelectorAll(
'.docx, .docx-wrapper, .docx-preview-wrapper'
);
".docx, .docx-wrapper, .docx-preview-wrapper",
)
wrappers.forEach((el) => {
const wrapper = el as HTMLElement;
wrapper.style.removeProperty('width');
wrapper.style.removeProperty('max-width');
wrapper.style.removeProperty('min-width');
wrapper.style.width = '100%';
wrapper.style.maxWidth = '100%';
wrapper.style.minWidth = 'auto';
});
const wrapper = el as HTMLElement
wrapper.style.removeProperty("width")
wrapper.style.removeProperty("max-width")
wrapper.style.removeProperty("min-width")
wrapper.style.width = "100%"
wrapper.style.maxWidth = "100%"
wrapper.style.minWidth = "auto"
})

// Make tables responsive
const tables = containerRef.current.querySelectorAll('table');
const tables = containerRef.current.querySelectorAll("table")
tables.forEach((table) => {
const tableEl = table as HTMLElement;
tableEl.style.width = '100%';
tableEl.style.maxWidth = '100%';
tableEl.style.minWidth = 'auto';
tableEl.style.tableLayout = 'fixed'; // Better for responsive tables
const tableEl = table as HTMLElement
tableEl.style.width = "100%"
tableEl.style.maxWidth = "100%"
tableEl.style.minWidth = "auto"
tableEl.style.tableLayout = "fixed" // Better for responsive tables

// Make all cells wrap content properly
const cells = tableEl.querySelectorAll('td, th');
const cells = tableEl.querySelectorAll("td, th")
cells.forEach((cell) => {
const cellEl = cell as HTMLElement;
cellEl.style.overflowWrap = 'break-word';
cellEl.style.whiteSpace = 'normal';
cellEl.style.maxWidth = '0'; // Forces text wrapping
cellEl.style.minWidth = '100px';
cellEl.style.boxSizing = 'border-box';
cellEl.style.padding = '5px';
});
});
const cellEl = cell as HTMLElement
cellEl.style.overflowWrap = "break-word"
cellEl.style.whiteSpace = "normal"
cellEl.style.maxWidth = "0" // Forces text wrapping
cellEl.style.minWidth = "100px"
cellEl.style.boxSizing = "border-box"
cellEl.style.padding = "5px"
})
})

// Make images responsive
const images = containerRef.current.querySelectorAll('img');
const images = containerRef.current.querySelectorAll("img")
images.forEach((img) => {
const imgEl = img as HTMLElement;
imgEl.style.maxWidth = '100%';
imgEl.style.height = 'auto';
imgEl.style.width = 'auto';
});
const imgEl = img as HTMLElement
imgEl.style.maxWidth = "100%"
imgEl.style.height = "auto"
imgEl.style.width = "auto"
})
}
} catch (e) {
const errorMessage =
Expand All @@ -239,7 +239,9 @@ export const DocxViewer: React.FC<DocxViewerProps> = ({
<div className="absolute inset-0 flex items-center justify-center bg-white/90 dark:bg-[#1E1E1E]/90 z-10">
<div className="text-center">
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-gray-600 dark:border-gray-300 mx-auto mb-4"></div>
<p className="text-gray-600 dark:text-gray-300">Loading document...</p>
<p className="text-gray-600 dark:text-gray-300">
Loading document...
</p>
</div>
</div>
)}
Expand Down
Loading