Skip to content
Merged
Show file tree
Hide file tree
Changes from 70 commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
f9939e9
feat: add data table component and integrate with apps route
ErwanDecoster Apr 30, 2025
daac74a
feat: add SearcherBar component and integrate it into apps and index …
ErwanDecoster Apr 30, 2025
048e909
refactor: remove unused Link import from columns.tsx
ErwanDecoster Apr 30, 2025
dc15279
feat: implement PaginatedNavigation component in AppsTable for pagina…
ErwanDecoster Apr 30, 2025
bfe4041
refactor: enhance pagination logic in PaginatedNavigation component f…
ErwanDecoster Apr 30, 2025
aa44344
refactor: adjust pagination logic in generatePaginationItems for impr…
ErwanDecoster Apr 30, 2025
a43e07d
fix: border transition looking bad
ErwanDecoster Apr 30, 2025
7026eae
refactor: update useAppsData to accept currentPage for dynamic data f…
ErwanDecoster Apr 30, 2025
bc1c2db
fix: add placeholderData to useQuery for improved data handling
ErwanDecoster Apr 30, 2025
c4c7665
refactor: wrap app name in a div and fixe is width
ErwanDecoster Apr 30, 2025
54b3344
fix: update TABLE_LENGTH to 16 for correct configuration
ErwanDecoster Apr 30, 2025
334af0a
refactor: remove AppsTable component and integrate its functionality …
ErwanDecoster Apr 30, 2025
633b2e7
feat: add Deals route with data fetching and pagination functionality
ErwanDecoster Apr 30, 2025
6389ebe
fix: rename taskQuery to tasksQuery for consistency in data fetching
ErwanDecoster Apr 30, 2025
bc0169d
refactor: reorganize imports and simplify conditional rendering in De…
ErwanDecoster Apr 30, 2025
d913a02
feat: implement Tasks route with data fetching, pagination, and task …
ErwanDecoster May 1, 2025
64a11f2
refactor: replace inline type definitions with GraphQL query types fo…
ErwanDecoster May 1, 2025
c88622b
fix: display workerpool description directly in the table instead of …
ErwanDecoster May 1, 2025
107359a
feat: add Workerpools route with data fetching, pagination, and table…
ErwanDecoster May 1, 2025
ebb7b3e
fix: wrap CopyButton in a div to set a fixed width for app name display
ErwanDecoster May 1, 2025
a0aa94f
fix: improve description display in workerpools table with consistent…
ErwanDecoster May 1, 2025
3c61cab
fix: replace CopyButton with conditional rendering for dataset name d…
ErwanDecoster May 1, 2025
05b2b85
feat: add Datasets route with data fetching, pagination, and table co…
ErwanDecoster May 1, 2025
7026fd1
fix: update PaginationEllipsis styling for better responsiveness
ErwanDecoster May 1, 2025
f3ef079
fix: update query state variables to indicate refetch and loading
ErwanDecoster May 1, 2025
4e9b092
fix: update loading indicator logic to show during loading or refetching
ErwanDecoster May 1, 2025
347109d
fix: adjust SearcherBar styling for improved layout and responsiveness
ErwanDecoster May 1, 2025
135bc85
fix: refactor SearcherBar layout for improved structure and styling
ErwanDecoster May 1, 2025
2a817d8
fix: adjust SearcherBar padding for improved layout consistency
ErwanDecoster May 1, 2025
c6cc91f
fix: simplify Button component structure in SearcherBar for cleaner code
ErwanDecoster May 1, 2025
4d207a2
fix: update PaginationPrevious and PaginationNext to use screen reade…
ErwanDecoster May 9, 2025
0cb3ff1
fix: refactor SearcherBar to improve button visibility and input clas…
ErwanDecoster May 14, 2025
cbbf3be
fix: update placeholder text in SearcherBar for clarity
ErwanDecoster May 14, 2025
92f5529
feat: rename folder
ErwanDecoster May 14, 2025
1f2f47d
feat: rename folder AppsTable/ to appTable/
ErwanDecoster May 14, 2025
258ea4f
fix: remove unnecessary 'use client' directive from multiple components
ErwanDecoster May 14, 2025
ae3cefc
feat: enhance DataTable component with tableLength and isLoading prop…
ErwanDecoster May 14, 2025
5745139
feat: move routes for apps, datasets, deals, tasks, and workerpools
ErwanDecoster May 14, 2025
2c784a1
fix: update destination paths for apps, datasets, deals, tasks, and w…
ErwanDecoster May 14, 2025
6053b75
feat: implement DataTable component and update routes to use it
ErwanDecoster May 14, 2025
2544b75
feat: replace useNavigate with Link in DataTable for improved navigation
ErwanDecoster May 14, 2025
69d3a3d
feat: refactor preview tables to use DataTable component for improved…
ErwanDecoster May 14, 2025
e6f90c9
fix: prevent default button behavior in CopyButton component
ErwanDecoster May 14, 2025
13d9030
feat: rename WorkerpoolsPreviewTable component and update import path
ErwanDecoster May 14, 2025
e81759b
fix: update import path for WorkerpoolsPreviewTable component
ErwanDecoster May 14, 2025
3e38af9
feat: add routes for datasets, deals, tasks, and workerpools with dat…
ErwanDecoster May 15, 2025
5bfa26e
refactor: remove unused AppsTable component and related code
ErwanDecoster May 15, 2025
4c04d5f
feat: add NextApps, NextDatasets, NextDeals, NextTasks, and NextWorke…
ErwanDecoster May 15, 2025
fa09d87
fix: update import path for WorkerpoolsPreviewTable component
ErwanDecoster May 15, 2025
aca2247
chore: update @radix-ui/react-slot version to 1.2.2 in package.json a…
ErwanDecoster May 16, 2025
960cf5d
feat: update pagination logic in multiple routes to adjust current pa…
ErwanDecoster May 16, 2025
9297649
feat: add ChainSelector component and integrate new chain Arbitrum Se…
ErwanDecoster May 20, 2025
6d5ccc5
fix: update danger color variables for improved accessibility
ErwanDecoster May 20, 2025
fbdff62
fix: replace Terminal icon with AlertOctagon in UnsupportedChain comp…
ErwanDecoster May 20, 2025
1ab0508
fix: adjust border radius and add left border to destructive alert va…
ErwanDecoster May 20, 2025
e8a808d
fix: remove Avalanche Fuji from configuration
ErwanDecoster May 20, 2025
ceef12b
fix: add color property to chain objects and update background color …
ErwanDecoster May 20, 2025
d956d68
feat: integrate subgraph URL management in user store and update quer…
ErwanDecoster May 20, 2025
664128a
fix: add query client initialization and invalidate queries in useSyn…
ErwanDecoster May 20, 2025
8fb7be5
Merge branch 'feature/add-main-pages' into feature/chain-switch
ErwanDecoster May 20, 2025
463d0f8
fix: update useUserStore import and refactor query execution in Tasks…
ErwanDecoster May 20, 2025
4c9dd9c
fix: update query execution in apps, datasets, deals, tasks, and work…
ErwanDecoster May 20, 2025
b5a3bcd
fix: update query execution in preview tables to include chainId in q…
ErwanDecoster May 20, 2025
02c5cc4
Merge branch 'main' into feature/chain-switch
ErwanDecoster May 21, 2025
8b939d7
fix: update query execution in WorkerpoolsPreviewTable to include cha…
ErwanDecoster May 21, 2025
428267b
fix: temps renaming
ErwanDecoster May 21, 2025
7af8875
fix: rename WorkerpoolsPreviewTable
ErwanDecoster May 21, 2025
5532f01
fix: correct import path for WorkerpoolsPreviewTable
ErwanDecoster May 21, 2025
067cbe9
fix: update ChainSelector to handle chainId as a required number
ErwanDecoster May 21, 2025
577a337
fix: update useSyncAccountWithUserStore to set chainId only when curr…
ErwanDecoster May 21, 2025
75b437a
fix: refactor to use chainId instead of subgraphUrl in various compon…
ErwanDecoster May 22, 2025
6c83ccf
fix: update subgraphUrl for Arbitrum Sepolia in SUPPORTED_CHAINS
ErwanDecoster May 22, 2025
9870248
fix: simplify ChainSelector by removing local state and using chainId…
ErwanDecoster May 22, 2025
cdac27a
feat: implement dynamic routes for chain-specific apps, datasets, tas…
ErwanDecoster May 22, 2025
ce5577f
feat: add missing deals page, lost during merge
ErwanDecoster May 22, 2025
862ac61
fix: import filename casing issue
PierreJeanjacquot May 22, 2025
7ea657b
refactor: introduce ChainSyncManager to keep chain state up to date
PierreJeanjacquot May 28, 2025
c09e2e6
fix: update redirect target to use INITIAL_CHAIN slug
ErwanDecoster May 28, 2025
4968a0c
fix: enable data fetching based on chainId
ErwanDecoster May 28, 2025
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
21 changes: 21 additions & 0 deletions src/assets/chain-icons/arbitrum-sepolia.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/components/UnsupportedChain.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SUPPORTED_CHAINS } from '@/config';
import { Terminal } from 'lucide-react';
import { AlertOctagon } from 'lucide-react';
import useUserStore from '@/stores/useUser.store';
import { Alert, AlertDescription, AlertTitle } from './ui/alert';

Expand All @@ -17,7 +17,7 @@ export function UnsupportedChain() {

return (
<Alert variant="destructive" className="mx-auto mt-8 text-left">
<Terminal className="h-4 w-4" />
<AlertOctagon className="h-4 w-4" />
<AlertTitle>Error</AlertTitle>
<AlertDescription>
It seems that you are using a chain that is not supported.
Expand Down
46 changes: 46 additions & 0 deletions src/components/navbar/ChainSelector.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { SUPPORTED_CHAINS } from '@/config.ts';
import { switchChain } from '@wagmi/core';
import { useEffect, useState } from 'react';
import useUserStore from '@/stores/useUser.store.ts';
import { wagmiAdapter } from '@/utils/wagmiConfig.ts';
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from '../ui/select.tsx';

export function ChainSelector() {
const { chainId } = useUserStore();
const [selectedChainId, setSelectedChainId] = useState<string>(
chainId.toString(),
);

useEffect(() => {
if (chainId) {
setSelectedChainId(chainId.toString());
}
}, [chainId]);

const handleChainChange = async (value: string) => {
setSelectedChainId(value);

switchChain(wagmiAdapter.wagmiConfig, { chainId: Number(value) });
};

return (
<Select value={selectedChainId} onValueChange={handleChainChange}>
<SelectTrigger>
<SelectValue placeholder="Select Chain" />
</SelectTrigger>
<SelectContent>
{SUPPORTED_CHAINS.map((chain) => (
<SelectItem key={chain.id} value={chain.id.toString()}>
<img src={chain.icon} className="size-4" alt="" /> {chain.name}
</SelectItem>
))}
</SelectContent>
</Select>
);
}
30 changes: 3 additions & 27 deletions src/components/navbar/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,8 @@ import { useLoginLogout } from '@/hooks/useLoginLogout';
import useUserStore from '@/stores/useUser.store';
import iExecLogo from '../../assets/iexec-logo.svg';
import { Button } from '../ui/button.tsx';
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from '../ui/select.tsx';
import { AddressChip } from './AddressChip.tsx';
import { ChainSelector } from './ChainSelector.tsx';

export function Navbar() {
const { isConnected, address } = useUserStore();
Expand All @@ -38,16 +32,7 @@ export function Navbar() {
</div>
)}
<div className="content hidden md:flex">
<Select value="bellecour">
<SelectTrigger className="">
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="bellecour">
<img src={iExecLogo} className="size-4" alt="" /> Bellecour
</SelectItem>
</SelectContent>
</Select>
<ChainSelector />
</div>
{isConnected ? (
<div className="flex max-w-[1260px] items-center gap-2">
Expand Down Expand Up @@ -119,16 +104,7 @@ export function Navbar() {
>
<Link to="/account">iExec Account</Link>
</Button>
<Select value="bellecour">
<SelectTrigger className="w-full border-none">
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="bellecour">
<img src={iExecLogo} className="size-4" alt="" /> Bellecour
</SelectItem>
</SelectContent>
</Select>
<ChainSelector />
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/ui/alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { cva, type VariantProps } from 'class-variance-authority';
import * as React from 'react';

const alertVariants = cva(
'relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current',
'relative w-full rounded border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current',
{
variants: {
variant: {
default: 'bg-card text-card-foreground',
destructive:
'text-destructive bg-danger border-danger-border [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90',
'text-destructive bg-danger border-danger-border [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90 border-l-4',
},
},
defaultVariants: {
Expand Down
14 changes: 13 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import arbitrumSepoliaIcon from './assets/chain-icons/arbitrum-sepolia.svg';
import iexecLogo from './assets/iexec-logo.svg';

export const PREVIEW_TABLE_LENGTH = 5;
export const TABLE_LENGTH = 16;
export const PREVIEW_TABLE_REFETCH_INTERVAL = 10_000;
Expand All @@ -6,8 +9,17 @@ export const SUPPORTED_CHAINS = [
{
id: 134,
name: 'Bellecour',
icon: 'src/assets/iexec-logo.svg',
color: '#F4942566',
icon: iexecLogo,
blockExplorerUrl: 'https://blockscout-bellecour.iex.ec',
subgraphUrl: 'https://thegraph.iex.ec/subgraphs/name/bellecour/poco-v5',
},
{
id: 421614,
name: 'Arbitrum Sepolia',
color: '#28A0F080',
icon: arbitrumSepoliaIcon,
blockExplorerUrl: 'https://sepolia.arbiscan.io/',
subgraphUrl: 'http://localhost:8080',
},
];
3 changes: 1 addition & 2 deletions src/graphql/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import type { TypedDocumentString } from './graphql'

export async function execute<TResult, TVariables>(
query: TypedDocumentString<TResult, TVariables>,
subgraphUrl: string,
...[variables]: TVariables extends Record<string, never> ? [] : [TVariables]
) {
const subgraphUrl = import.meta.env.VITE_POCO_SUBGRAPH_URL;

const response = await fetch(subgraphUrl, {
method: 'POST',
headers: {
Expand Down
23 changes: 20 additions & 3 deletions src/hooks/useSyncAccountWithUserStore.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
import { SUPPORTED_CHAINS } from '@/config';
import { useQueryClient } from '@tanstack/react-query';
import { useEffect } from 'react';
import { useAccount } from 'wagmi';
import useUserStore from '@/stores/useUser.store';

export function useSyncAccountWithUserStore() {
const { connector, status, address, chain, isConnected } = useAccount();
const { setConnector, setIsConnected, setAddress, setChainId } =
useUserStore();
const {
setConnector,
setIsConnected,
setAddress,
setChainId,
chainId,
setSubgraphUrl,
} = useUserStore();
const queryClient = useQueryClient();

useEffect(() => {
// Update userStore
setConnector(connector);
setIsConnected(isConnected);
setAddress(address);
setChainId(chain?.id);
const currentChain = SUPPORTED_CHAINS.find((c) => c.id === chain?.id);
if (currentChain) {
setSubgraphUrl(currentChain?.subgraphUrl);
queryClient.invalidateQueries({ queryKey: [chainId] });
setChainId(chain!.id);
}
}, [
connector,
status,
Expand All @@ -23,5 +37,8 @@ export function useSyncAccountWithUserStore() {
setIsConnected,
setAddress,
setChainId,
setSubgraphUrl,
queryClient,
chainId,
]);
}
6 changes: 3 additions & 3 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@
--color-success-foreground: var(--color-green-600);
--color-success-border: var(--color-green-600);

--color-danger: var(--color-red-100);
--color-danger-foreground: var(--color-red-600);
--color-danger-border: var(--color-red-600);
--color-danger: var(--color-red-900);
--color-danger-foreground: var(--color-red-100);
--color-danger-border: var(--color-red-500);

--color-warning: var(--color-orange-100);
--color-warning-foreground: var(--color-orange-600);
Expand Down
10 changes: 7 additions & 3 deletions src/modules/apps/AppsPreviewTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@ import { cn } from '@/lib/utils';
import { useQuery } from '@tanstack/react-query';
import { Link } from '@tanstack/react-router';
import { Box, LoaderCircle, Terminal } from 'lucide-react';
import { CircularLoader } from '@/components/CircularLoader';
import { DataTable } from '@/components/DataTable';
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';
import { Button } from '@/components/ui/button';
import useUserStore from '@/stores/useUser.store';
import { appsQuery } from './appsQuery';
import { columns } from './appsTable/columns';

export function AppsPreviewTable({ className }: { className?: string }) {
const { subgraphUrl, chainId } = useUserStore();
const apps = useQuery({
queryKey: ['apps_preview'],
queryKey: [chainId, 'apps_preview'],
queryFn: () =>
execute(appsQuery, { length: PREVIEW_TABLE_LENGTH, skip: 0 }),
execute(appsQuery, subgraphUrl, {
length: PREVIEW_TABLE_LENGTH,
skip: 0,
}),
refetchInterval: PREVIEW_TABLE_REFETCH_INTERVAL,
});

Expand Down
10 changes: 7 additions & 3 deletions src/modules/datasets/DatasetsPreviewTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@ import { cn } from '@/lib/utils';
import { useQuery } from '@tanstack/react-query';
import { Link } from '@tanstack/react-router';
import { Box, LoaderCircle, Terminal } from 'lucide-react';
import { CircularLoader } from '@/components/CircularLoader';
import { DataTable } from '@/components/DataTable';
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';
import { Button } from '@/components/ui/button';
import useUserStore from '@/stores/useUser.store';
import { datasetsQuery } from './datasetsQuery';
import { columns } from './datasetsTable/columns';

export function DatasetsPreviewTable({ className }: { className?: string }) {
const { subgraphUrl, chainId } = useUserStore();
const datasets = useQuery({
queryKey: ['datasets_preview'],
queryKey: [chainId, 'datasets_preview'],
queryFn: () =>
execute(datasetsQuery, { length: PREVIEW_TABLE_LENGTH, skip: 0 }),
execute(datasetsQuery, subgraphUrl, {
length: PREVIEW_TABLE_LENGTH,
skip: 0,
}),
refetchInterval: PREVIEW_TABLE_REFETCH_INTERVAL,
});

Expand Down
10 changes: 7 additions & 3 deletions src/modules/deals/DealsPreviewTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@ import { cn } from '@/lib/utils';
import { useQuery } from '@tanstack/react-query';
import { Link } from '@tanstack/react-router';
import { Box, LoaderCircle, Terminal } from 'lucide-react';
import { CircularLoader } from '@/components/CircularLoader';
import { DataTable } from '@/components/DataTable';
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';
import { Button } from '@/components/ui/button';
import useUserStore from '@/stores/useUser.store';
import { dealsQuery } from './dealsQuery';
import { columns } from './dealsTable/columns';

export function DealsPreviewTable({ className }: { className?: string }) {
const { subgraphUrl, chainId } = useUserStore();
const deals = useQuery({
queryKey: ['deals_preview'],
queryKey: [chainId, 'deals_preview'],
queryFn: () =>
execute(dealsQuery, { length: PREVIEW_TABLE_LENGTH, skip: 0 }),
execute(dealsQuery, subgraphUrl, {
length: PREVIEW_TABLE_LENGTH,
skip: 0,
}),
refetchInterval: PREVIEW_TABLE_REFETCH_INTERVAL,
});

Expand Down
10 changes: 7 additions & 3 deletions src/modules/tasks/TasksPreviewTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@ import { cn } from '@/lib/utils';
import { useQuery } from '@tanstack/react-query';
import { Link } from '@tanstack/react-router';
import { Box, LoaderCircle, Terminal } from 'lucide-react';
import { CircularLoader } from '@/components/CircularLoader';
import { DataTable } from '@/components/DataTable';
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';
import { Button } from '@/components/ui/button';
import useUserStore from '@/stores/useUser.store';
import { tasksQuery } from './tasksQuery';
import { columns } from './tasksTable/columns';

export function TasksPreviewTable({ className }: { className?: string }) {
const { subgraphUrl, chainId } = useUserStore();
const tasks = useQuery({
queryKey: ['tasks_preview'],
queryKey: [chainId, 'tasks_preview'],
queryFn: () =>
execute(tasksQuery, { length: PREVIEW_TABLE_LENGTH, skip: 0 }),
execute(tasksQuery, subgraphUrl, {
length: PREVIEW_TABLE_LENGTH,
skip: 0,
}),
refetchInterval: PREVIEW_TABLE_REFETCH_INTERVAL,
});

Expand Down
7 changes: 4 additions & 3 deletions src/modules/workerpools/WorkerpoolsPreviewTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@ import { cn } from '@/lib/utils';
import { useQuery } from '@tanstack/react-query';
import { Link } from '@tanstack/react-router';
import { Box, LoaderCircle, Terminal } from 'lucide-react';
import { CircularLoader } from '@/components/CircularLoader';
import { DataTable } from '@/components/DataTable';
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';
import { Button } from '@/components/ui/button';
import { workerpoolsQuery } from './workerpoolsQuery';
import { columns } from './workerpoolsTable/columns';
import useUserStore from '@/stores/useUser.store';

export function WorkerpoolsPreviewTable({ className }: { className?: string }) {
const { subgraphUrl, chainId } = useUserStore();
const workerpools = useQuery({
queryKey: ['workerpools_preview'],
queryKey: [chainId, 'workerpools_preview'],
queryFn: () =>
execute(workerpoolsQuery, { length: PREVIEW_TABLE_LENGTH, skip: 0 }),
execute(workerpoolsQuery, subgraphUrl, { length: PREVIEW_TABLE_LENGTH, skip: 0 }),
refetchInterval: PREVIEW_TABLE_REFETCH_INTERVAL,
});

Expand Down
Loading
Loading