feat(chat): replace LoadingPage with LoadingSpinner for better loading indication
feat(chat): adjust LoadingSpinner size in ChatBottombar component feat(data-table): add defaultPageSize prop for customizable pagination
This commit is contained in:
parent
f790838093
commit
8f28b7bba3
3 changed files with 10 additions and 4 deletions
|
|
@ -2,7 +2,7 @@ import { Download } from "lucide-react";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { ExtIcon } from "~/components/area-riservata/allegati";
|
import { ExtIcon } from "~/components/area-riservata/allegati";
|
||||||
|
|
||||||
import { LoadingPage } from "~/components/loading";
|
import { LoadingSpinner } from "~/components/spinner";
|
||||||
import { Button } from "~/components/ui/button";
|
import { Button } from "~/components/ui/button";
|
||||||
import { getStorageUrl } from "~/lib/storage_utils";
|
import { getStorageUrl } from "~/lib/storage_utils";
|
||||||
import type { MessagesMessageid } from "~/schemas/public/Messages";
|
import type { MessagesMessageid } from "~/schemas/public/Messages";
|
||||||
|
|
@ -19,7 +19,11 @@ export const ChatAttachments = ({
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
return <LoadingPage />;
|
return (
|
||||||
|
<div className="mt-1 flex items-end rounded-md bg-secondary p-1.5">
|
||||||
|
<LoadingSpinner className="text-primary" />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (!data || data.length === 0) {
|
if (!data || data.length === 0) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -330,7 +330,7 @@ export default function ChatBottombar() {
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
>
|
>
|
||||||
{isLoading ? (
|
{isLoading ? (
|
||||||
<LoadingSpinner className="size-6" />
|
<LoadingSpinner className="size-5" />
|
||||||
) : message.length !== 0 ? (
|
) : message.length !== 0 ? (
|
||||||
<SendHorizontal className="text-muted-foreground" size={20} />
|
<SendHorizontal className="text-muted-foreground" size={20} />
|
||||||
) : (
|
) : (
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ type DataTableProps<TData, TValue> = {
|
||||||
onStateChange?: () => void;
|
onStateChange?: () => void;
|
||||||
defaultFilterState?: ColumnFiltersState;
|
defaultFilterState?: ColumnFiltersState;
|
||||||
onTableInit?: (table: TableType<TData>) => void;
|
onTableInit?: (table: TableType<TData>) => void;
|
||||||
|
defaultPageSize?: number;
|
||||||
} & (
|
} & (
|
||||||
| {
|
| {
|
||||||
withContextMenu: true;
|
withContextMenu: true;
|
||||||
|
|
@ -84,12 +85,13 @@ export function DataTable<TData, TValue>({
|
||||||
onTableInit,
|
onTableInit,
|
||||||
withContextMenu,
|
withContextMenu,
|
||||||
contextMenuContent,
|
contextMenuContent,
|
||||||
|
defaultPageSize = 20,
|
||||||
}: DataTableProps<TData, TValue>) {
|
}: DataTableProps<TData, TValue>) {
|
||||||
const [sorting, setSorting] = useState<SortingState>(defaultSort || []);
|
const [sorting, setSorting] = useState<SortingState>(defaultSort || []);
|
||||||
const [rowSelection, setRowSelection] = useState<RowSelectionState>({});
|
const [rowSelection, setRowSelection] = useState<RowSelectionState>({});
|
||||||
const [pagination, setPagination] = useState({
|
const [pagination, setPagination] = useState({
|
||||||
pageIndex: 0, //initial page index
|
pageIndex: 0, //initial page index
|
||||||
pageSize: 20, //default page size
|
pageSize: defaultPageSize, //default page size
|
||||||
});
|
});
|
||||||
|
|
||||||
const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>(
|
const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>(
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue