Add full shell, replaceable Omics adapter and bilingual interaction
Implement approved specification #32 and tickets #33-#37. Keep host authentication server-verified and pin session interaction language. Compile scoped base selectors for browser compatibility and retain full gutters during CSS pruning.
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
import { AgGridReact } from "ag-grid-react";
|
||||
import { AllCommunityModule, ModuleRegistry } from "ag-grid-community";
|
||||
import { useRef } from "react";
|
||||
import { AllCommunityModule, ModuleRegistry, type GridState } from "ag-grid-community";
|
||||
import { AG_GRID_LOCALE_EN, AG_GRID_LOCALE_IT } from "@ag-grid-community/locale";
|
||||
import { useI18n } from "../i18n";
|
||||
import "ag-grid-community/styles/ag-grid.css";
|
||||
import "ag-grid-community/styles/ag-theme-alpine.css";
|
||||
|
||||
// Register AG Grid modules once at module load time
|
||||
ModuleRegistry.registerModules([AllCommunityModule]);
|
||||
@@ -11,6 +16,9 @@ interface Props {
|
||||
|
||||
/** Reusable read-only preview grid: columns + row tuples → AG Grid. */
|
||||
export function PreviewGrid({ columns, rows }: Props) {
|
||||
const { locale } = useI18n();
|
||||
const gridMessages: Readonly<Record<string, string>> = locale === "it" ? AG_GRID_LOCALE_IT : AG_GRID_LOCALE_EN;
|
||||
const gridState = useRef<GridState>();
|
||||
const columnDefs = columns.map((col) => ({ field: col, headerName: col }));
|
||||
|
||||
const rowData = rows.map((row) => {
|
||||
@@ -23,8 +31,16 @@ export function PreviewGrid({ columns, rows }: Props) {
|
||||
|
||||
return (
|
||||
<div className="overflow-hidden rounded-xl border border-border/70 shadow-xs">
|
||||
<div className="ag-theme-alpine" style={{ height: 400, width: "100%" }}>
|
||||
<AgGridReact columnDefs={columnDefs} rowData={rowData} />
|
||||
<div className="ag-theme-alpine thot-preview-grid" style={{ height: 400, width: "100%" }}>
|
||||
<AgGridReact
|
||||
key={locale}
|
||||
theme="legacy"
|
||||
columnDefs={columnDefs}
|
||||
rowData={rowData}
|
||||
localeText={gridMessages}
|
||||
initialState={gridState.current}
|
||||
onStateUpdated={({ state }) => { gridState.current = state; }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user