Skip to content

Commit

Permalink
Merge branch 'dataset-page'
Browse files Browse the repository at this point in the history
  • Loading branch information
luccasmmg committed Aug 30, 2024
2 parents 6956ca1 + ce6b64c commit 7fc6581
Show file tree
Hide file tree
Showing 40 changed files with 9,009 additions and 15,196 deletions.
Binary file modified frontend/bun.lockb
Binary file not shown.
20,862 changes: 6,727 additions & 14,135 deletions frontend/package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@
"@hookform/resolvers": "^3.9.0",
"@next/font": "^14.2.6",
"@portaljs/ckan": "^0.1.0",
"@portaljs/components": "0.3.1",
"@portaljs/core": "^1.0.6",
"@radix-ui/react-accordion": "^1.2.0",
"@radix-ui/react-avatar": "^1.1.0",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-popover": "^1.0.7",
"@radix-ui/react-scroll-area": "^1.0.5",
"@radix-ui/react-select": "^2.0.0",
"@radix-ui/react-select": "^2.1.1",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-tabs": "^1.1.0",
"@radix-ui/react-toast": "^1.2.1",
Expand Down Expand Up @@ -57,12 +55,13 @@
"crypto": "^1.0.1",
"crypto-hash": "^2.0.1",
"date-fns": "^3.6.0",
"embla-carousel-react": "^8.2.0",
"formik": "^2.2.9",
"frictionless-js-browser": "^1.0.8",
"frictionless.js": "^0.13.4",
"ky": "^0.33.3",
"libsodium-wrappers": "^0.7.11",
"lucide-react": "^0.435.0",
"lucide-react": "^0.436.0",
"minisearch": "^5.0.0",
"next": "13.4.2",
"next-auth": "^4.22.4",
Expand All @@ -78,6 +77,7 @@
"react-popper": "^2.3.0",
"react-select": "^5.7.4",
"react-toastify": "^9.1.3",
"recharts": "^2.12.7",
"sass": "^1.54.0",
"simple-oauth2": "^5.0.0",
"slugify": "^1.6.6",
Expand Down
Binary file added frontend/public/images/fileIcons/csv.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/images/fileIcons/json.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/images/fileIcons/pdf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/images/fileIcons/undefined.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/images/fileIcons/xls.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/images/fileIcons/xml.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions frontend/src/components/data-explorer/DataExplorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export function DataExplorer({ resourceId }: { resourceId: string }) {
if (!tableData)
return (
<div className="bg-lima-700 my-auto flex w-full flex-col items-center justify-center overflow-hidden opacity-75 h-full">
<Spinner className="text-blue-800 w-12 h-12" />
<h2 className="text-center text-xl font-semibold text-blue-800">
<Spinner className="text-accent w-12 h-12" />
<h2 className="text-center text-xl font-semibold text-accent">
Loading...
</h2>
</div>
Expand Down Expand Up @@ -156,21 +156,21 @@ function DataExplorerInner({ resourceId, columns }: DataExplorerInnerProps) {
});
if (pageCount < pagination.pageIndex) resetPagination();
return (
<div className={`w-full relative grow flex flex-col gap-y-2 mt-6`}>
<div className="flex flex-col gap-y-4 sm:flex-row justify-between items-end sm:items-center px-6">
<div className={`w-full relative grow flex flex-col gap-y-2`}>
<div className="flex flex-col gap-y-4 sm:flex-row justify-between items-end sm:items-center">
<TopBar table={table} numOfRows={numOfRows ?? 0} />
</div>
<div className="flex flex-row justify-between gap-x-2 px-6">
<div className="flex flex-row justify-between gap-x-2">
<div className="flex flex-row justify-between grow">
<ListOfFilters
filters={filteredColumns}
setFilters={setColumnFilters}
/>
</div>
</div>
<div className="flex flex-col grow border border-gray-200">
<div className="flex flex-col grow shadow ring-1 ring-black ring-opacity-5 sm:rounded-lg">
{isFetching && isPlaceholderData && (
<span className="w-full h-1.5 animate-pulse-fast bg-blue-400" />
<span className="w-full h-1.5 animate-pulse-fast bg-accent/10" />
)}
<Table
table={table}
Expand Down
108 changes: 29 additions & 79 deletions frontend/src/components/data-explorer/SimpleSelect.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { Fragment } from "react";
import { Listbox, Transition } from "@headlessui/react";
import { ChevronDownIcon } from "lucide-react";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import {
Controller,
FieldValues,
Expand All @@ -10,6 +17,7 @@ import {
useForm,
} from "react-hook-form";
import { cn } from "@/lib/utils";
import { Socket } from "dgram";

export interface Option<V> {
label: string;
Expand Down Expand Up @@ -43,91 +51,33 @@ export default function SimpleSelect<T extends FieldValues, V extends Object>({
control={control}
name={name}
defaultValue={
options.find((option) => option.default) ??
({
value: "",
label: "",
} as PathValue<T, Path<T> & Option<V>>)
options.find((option) => option.default)?.value ?? ''
}
render={({ field: { onChange: setSelected, value: selected } }) => (
<Listbox
value={selected}
onChange={(e) => {
render={({ field: { onChange: setSelected, value: selected } }) => {
console.log(selected);
return (
<Select
defaultValue={selected !== '' ? selected : undefined}
onValueChange={(e) => {
if (_onChange && e != null) {
_onChange(e.value);
_onChange(e);
}
setSelected(e);
}}
>
{({ open }) => (
<>
<div className={cn("relative w-full", maxWidth)}>
<Listbox.Button
id={id}
className={cn(
"relative text-left block w-full rounded-md border-0 px-5 py-3 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:border-b-2 focus:border-blue-800 focus:bg-slate-100 focus:ring-0 focus:ring-offset-0 sm:text-sm sm:leading-6",
className ?? ""
)}
>
<span
className={cn(
selected && selected.label ? "" : "text-zinc-400",
"block truncate"
)}
>
{selected && selected.label
? selected.label.charAt(0).toUpperCase() +
selected.label.slice(1)
: placeholder}
</span>
<span className="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2">
<ChevronDownIcon
className="h-5 w-5 text-gray-400"
aria-hidden="true"
/>
</span>
</Listbox.Button>

<Transition
show={open}
as={Fragment}
leave="transition ease-in duration-100"
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<Listbox.Options className="absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm">
{options.map((option) => (
<Listbox.Option
key={option.value}
className={({ active }) =>
cn(
active ? "bg-blue-800 text-white" : "text-gray-900",
"relative cursor-default select-none py-2 pl-3 pr-9"
)
}
value={option}
>
{({ selected, active }) => (
<>
<span
className={cn(
selected ? "font-semibold" : "font-normal",
"block truncate"
)}
>
{option.label}
</span>
</>
)}
</Listbox.Option>
))}
</Listbox.Options>
</Transition>
</div>
</>
)}
</Listbox>
)}
<SelectTrigger className={cn("w-full", maxWidth)}>
<SelectValue placeholder={placeholder} />
</SelectTrigger>
<SelectContent>
{options.map((o) => (
<SelectItem key={o.value} value={o.value}>
{o.label}
</SelectItem>
))}
</SelectContent>
</Select>
)
}}
/>
);
}
Loading

0 comments on commit 7fc6581

Please sign in to comment.