Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
90 changes: 45 additions & 45 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
NEXTAUTH_URL=http://localhost:3000
NEXT_PUBLIC_APP_URL=http://localhost:3000
AUTH_SECRET= # https://generate-secret.vercel.app/32

COMMUNITIES_CONFIG_URL=''

# Brevo
BREVO_API_KEY=
BREVO_SENDER_EMAIL=
BREVO_SENDER_NAME=

# Server Account
SERVER_PRIVATE_KEY=
SERVER_ACCOUNT_ADDRESS=

# Supabase top level
SUPABASE_URL=https://...
SUPABASE_ANON_KEY=...
SUPABASE_SERVICE_ROLE_KEY=...
SUPABASE_DB_PASSWORD=

# Supabase for chain 100 (Gnosis Chain)
SUPABASE_100_URL=https://...
SUPABASE_100_ANON_KEY=...
SUPABASE_100_SERVICE_ROLE_KEY=...

# Supabase for chain 137 (Polygon)
SUPABASE_137_URL=https://...
SUPABASE_137_ANON_KEY=...
SUPABASE_137_SERVICE_ROLE_KEY=...

# Supabase for chain 42220 (Celo)
SUPABASE_42220_URL=https://...
SUPABASE_42220_ANON_KEY=...
SUPABASE_42220_SERVICE_ROLE_KEY=...
SERVER_42220_ACCOUNT_ADDRESS=
SERVER_42220_WALLET_PRIVATE_KEY=


# Supabase for chain 8453 (Base)
SUPABASE_8453_URL=https://...
SUPABASE_8453_ANON_KEY=...
SUPABASE_8453_SERVICE_ROLE_KEY=...

# ONRAMP
NEXTAUTH_URL=http://localhost:3000
NEXT_PUBLIC_APP_URL=http://localhost:3000
AUTH_SECRET= # https://generate-secret.vercel.app/32
COMMUNITIES_CONFIG_URL=''
# Brevo
BREVO_API_KEY=
BREVO_SENDER_EMAIL=
BREVO_SENDER_NAME=
# Server Account
SERVER_PRIVATE_KEY=
SERVER_ACCOUNT_ADDRESS=
# Supabase top level
SUPABASE_URL=https://...
SUPABASE_ANON_KEY=...
SUPABASE_SERVICE_ROLE_KEY=...
SUPABASE_DB_PASSWORD=
# Supabase for chain 100 (Gnosis Chain)
SUPABASE_100_URL=https://...
SUPABASE_100_ANON_KEY=...
SUPABASE_100_SERVICE_ROLE_KEY=...
# Supabase for chain 137 (Polygon)
SUPABASE_137_URL=https://...
SUPABASE_137_ANON_KEY=...
SUPABASE_137_SERVICE_ROLE_KEY=...
# Supabase for chain 42220 (Celo)
SUPABASE_42220_URL=https://...
SUPABASE_42220_ANON_KEY=...
SUPABASE_42220_SERVICE_ROLE_KEY=...
SERVER_42220_ACCOUNT_ADDRESS=
SERVER_42220_WALLET_PRIVATE_KEY=
# Supabase for chain 8453 (Base)
SUPABASE_8453_URL=https://...
SUPABASE_8453_ANON_KEY=...
SUPABASE_8453_SERVICE_ROLE_KEY=...
# ONRAMP
TRANSAK_API_KEY=...
74 changes: 37 additions & 37 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# env files
.env*
!.env.example

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
# env files
!.env.example
# vercel
.vercel
# typescript
*.tsbuildinfo
next-env.d.ts
config.bat
102 changes: 51 additions & 51 deletions app/(home)/_table/communities-table.tsx
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
import { columns } from './columns';
import { DataTable } from '@/components/ui/data-table';
import { Config } from '@citizenwallet/sdk';
import { fetchCommunitiesForAdminAction } from '@/app/_actions/community-actions';
import { Separator } from '@/components/ui/separator';

interface CommunitiesTableProps {
query: string;
page: number;
}

export async function CommunitiesTable({ query }: CommunitiesTableProps) {
let communities: Config[] = [];
let total: number = 0;

try {
const result = await fetchCommunitiesForAdminAction({
query: query
});

communities = result.communities;
total = result.total;
} catch (error) {
console.error(error);
}

return (
<div className="flex flex-1 w-full flex-col h-full">
<div className="grid grid-cols-2 gap-4 mb-4">
<div className="flex flex-col">
<h1 className="text-2xl font-bold">Communities</h1>
<p className="text-sm text-gray-500">Browse communities</p>
</div>
</div>

<div className="flex-1 overflow-hidden">
<div className="h-full overflow-y-auto rounded-md border">
<DataTable columns={columns} data={communities} />
</div>
</div>

<Separator className="my-4" />

<div className="sticky bottom-0 left-0 right-0 bg-background flex flex-col sm:flex-row justify-between items-center gap-2 pb-4">
<p className="text-sm text-gray-500 whitespace-nowrap">
Total: {total}
</p>
</div>
</div>
);
}
import { columns } from './columns';
import { DataTable } from '@/components/ui/data-table';
import { Config } from '@citizenwallet/sdk';
import { fetchCommunitiesForAdminAction } from '@/app/_actions/community-actions';
import { Separator } from '@/components/ui/separator';
interface CommunitiesTableProps {
query: string;
page: number;
}
export async function CommunitiesTable({ query }: CommunitiesTableProps) {
let communities: Config[] = [];
let total: number = 0;
try {
const result = await fetchCommunitiesForAdminAction({
query: query
});
communities = result.communities;
total = result.total;
} catch (error) {
console.error(error);
}
return (
<div className="flex flex-1 w-full flex-col h-full">
<div className="grid grid-cols-2 gap-4 mb-4">
<div className="flex flex-col">
<h1 className="text-2xl font-bold">Communities</h1>
<p className="text-sm text-gray-500">Browse communities</p>
</div>
</div>
<div className="flex-1 overflow-hidden">
<div className="h-full overflow-y-auto rounded-md border">
<DataTable columns={columns} data={communities} />
</div>
</div>
<Separator className="my-4" />
<div className="sticky bottom-0 left-0 right-0 bg-background flex flex-col sm:flex-row justify-between items-center gap-2 pb-4">
<p className="text-sm text-gray-500 whitespace-nowrap">
Total: {total}
</p>
</div>
</div>
);
}
74 changes: 37 additions & 37 deletions app/(home)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
import { Suspense } from 'react';
import { skeletonColumns } from './_table/columns';
import { DataTable } from '@/components/ui/data-table';
import { CommunitiesTable } from './_table/communities-table';
import { placeholderData } from './_table/columns';

export default async function Page(props: {
searchParams: Promise<{ query?: string; page?: string }>;
}) {
const { query: queryParam, page: pageParam } = await props.searchParams;
const query = queryParam || '';
const page = pageParam || '1';

return (
<Suspense key={query + page} fallback={<Fallback />}>
<CommunitiesTable query={query} page={parseInt(page)} />
</Suspense>
);
}

function Fallback() {
return (
<div className="flex flex-1 w-full flex-col h-full">
<div className="grid grid-cols-2 gap-4 mb-4">
<div className="flex flex-col">
<h1 className="text-2xl font-bold">Communities</h1>
</div>
</div>

<div className="flex-1 overflow-hidden">
<div className="h-full overflow-y-auto rounded-md border">
<DataTable columns={skeletonColumns} data={placeholderData} />
</div>
</div>
</div>
);
}
import { Suspense } from 'react';
import { skeletonColumns } from './_table/columns';
import { DataTable } from '@/components/ui/data-table';
import { CommunitiesTable } from './_table/communities-table';
import { placeholderData } from './_table/columns';
export default async function Page(props: {
searchParams: Promise<{ query?: string; page?: string }>;
}) {
const { query: queryParam, page: pageParam } = await props.searchParams;
const query = queryParam || '';
const page = pageParam || '1';
return (
<Suspense key={query + page} fallback={<Fallback />}>
<CommunitiesTable query={query} page={parseInt(page)} />
</Suspense>
);
}
function Fallback() {
return (
<div className="flex flex-1 w-full flex-col h-full">
<div className="grid grid-cols-2 gap-4 mb-4">
<div className="flex flex-col">
<h1 className="text-2xl font-bold">Communities</h1>
</div>
</div>
<div className="flex-1 overflow-hidden">
<div className="h-full overflow-y-auto rounded-md border">
<DataTable columns={skeletonColumns} data={placeholderData} />
</div>
</div>
</div>
);
}
Loading