Skip to content

Commit

Permalink
Indexer API bindings, UI kit updates, and minor fixes (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
carina-akaia authored Jun 13, 2024
1 parent 3cd02ed commit dbbd83a
Show file tree
Hide file tree
Showing 138 changed files with 5,720 additions and 513 deletions.
10 changes: 7 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@
"@typescript-eslint",
"prettier",
"import",
"@tanstack/query",
"testing-library"
],
"extends": [
"next/core-web-vitals",
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
// Tanstack
"plugin:@tanstack/eslint-plugin-query/recommended",
// configuration for "import" plugin
"plugin:import/recommended",
"plugin:import/typescript",
Expand Down Expand Up @@ -91,6 +88,13 @@
"caseInsensitive": true
}
}
],
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_"
}
]
}
}
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"antfu.unocss",
"aaron-bond.better-comments",
"streetsidesoftware.code-spell-checker",
"gruntfuggly.todo-tree"
"gruntfuggly.todo-tree",
"naumovs.color-highlight"
]
}
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,22 @@
"source.fixAll": "explicit"
},
"cSpell.words": [
"Attributify",
"bitget",
"camelcase",
"colocation",
"data-testid",
"hookform",
"kubb",
"NADABOT",
"narwallets",
"naxios",
"nearfi",
"openapi",
"potfactory",
"POTLOCK",
"ramper",
"sessionid",
"shadcn",
"typecheck",
"unocss",
Expand Down
2 changes: 1 addition & 1 deletion components.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"aliases": {
"components": "src/common/ui",
"utils": "src/common/ui/utils",
"utils": "@/common/ui/utils",
"ui": "src/common/ui/components"
}
}
33 changes: 33 additions & 0 deletions kubb.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { defineConfig } from "@kubb/core";
import { pluginOas } from "@kubb/plugin-oas";
import { pluginSwr } from "@kubb/swagger-swr";
import { pluginTs } from "@kubb/swagger-ts";
import { pluginZod } from "@kubb/swagger-zod";

export default defineConfig({
root: "./src/",

input: {
path: "https://dev.potlock.io/api/schema",
},

output: {
path: "./common/api/potlock/generated",
clean: true,
},

plugins: [
pluginOas(),
pluginTs(),
pluginZod(),

pluginSwr({
output: { path: "./hooks", exportAs: "swrHooks" },
parser: "zod",
}),
],

hooks: {
done: ["yarn format"],
},
});
9 changes: 9 additions & 0 deletions next.config.mjs → next.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import UnoCSS from "@unocss/webpack";

/** @type {import('next').NextConfig} */
const nextConfig = {
images: {
Expand All @@ -9,6 +11,13 @@ const nextConfig = {
},
],
},

webpack: ({ plugins, ...config }) => ({
...config,
// Required for HMR support for UnoCSS
cache: false,
plugins: [...plugins, UnoCSS()],
}),
};

export default nextConfig;
54 changes: 39 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,28 @@
"private": true,
"type": "module",
"scripts": {
"typecheck": "tsc --noEmit",
"lint": "next lint",
"test:unit": "vitest run",
"dev:test": "yarn && vitest watch",
"dev": "yarn && next dev",
"build": "next build",
"start": "next start"
"format": "yarn lint --fix",
"typecheck": "tsc --noEmit",
"generate:api": "kubb --config kubb.config.ts",
"dev:test": "yarn && yarn generate:api && vitest watch",
"dev": "yarn && yarn generate:api; next dev",
"build": "yarn generate:api; next build",
"start": "next start",
"test:unit": "vitest run"
},
"dependencies": {
"@ebay/nice-modal-react": "^1.2.13",
"@hookform/resolvers": "^3.6.0",
"@kubb/cli": "^2.19.5",
"@kubb/core": "^2.19.5",
"@kubb/plugin-oas": "^2.19.5",
"@kubb/react": "^2.19.5",
"@kubb/swagger": "^2.19.5",
"@kubb/swagger-client": "^2.19.5",
"@kubb/swagger-swr": "^2.19.5",
"@kubb/swagger-ts": "^2.19.5",
"@kubb/swagger-zod": "^2.19.5",
"@near-wallet-selector/bitget-wallet": "^8.9.5",
"@near-wallet-selector/coin98-wallet": "^8.9.5",
"@near-wallet-selector/here-wallet": "^8.9.5",
Expand All @@ -35,9 +48,11 @@
"@radix-ui/react-accordion": "^1.1.2",
"@radix-ui/react-avatar": "^1.0.4",
"@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-popover": "^1.0.7",
"@radix-ui/react-radio-group": "^1.1.3",
"@radix-ui/react-select": "^2.0.0",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-switch": "^1.0.3",
Expand All @@ -47,33 +62,40 @@
"@rematch/immer": "^2.1.3",
"@rematch/loading": "^2.1.2",
"@rematch/persist": "^2.1.2",
"@tanstack/react-query": "^5.36.1",
"@unocss/reset": "^0.60.4",
"@wpdas/naxios": "^2.1.0",
"@zodios/core": "^10.9.6",
"axios": "^1.7.2",
"big.js": "^6.2.1",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"immer": "^9.0.21",
"lucide-react": "^0.378.0",
"near-api-js": "^2.1.4",
"next": "14.2.3",
"react": "^18",
"react-dom": "^18",
"next": "^14.2.3",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-hook-form": "^7.51.5",
"react-infinite-scroll-component": "^6.1.0",
"react-redux": "^9.1.2",
"redux": "^5.0.1",
"sass": "^1.77.2",
"swr": "^2.2.5",
"tailwind-merge": "^2.3.0",
"tailwindcss-animate": "^1.0.7"
"tailwindcss-animate": "^1.0.7",
"zod": "^3.23.8"
},
"devDependencies": {
"@tanstack/eslint-plugin-query": "^5.35.6",
"@testing-library/react": "^15.0.7",
"@types/big.js": "^6.2.2",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.9.0",
"@typescript-eslint/parser": "^7.9.0",
"@unocss/preset-attributify": "^0.60.4",
"@unocss/preset-wind": "^0.60.4",
"@unocss/webpack": "^0.60.4",
"@vitejs/plugin-react": "^4.3.0",
"eslint": "^8",
"eslint-config-next": "14.2.3",
Expand All @@ -87,9 +109,11 @@
"prettier-plugin-tailwindcss": "^0.5.14",
"tailwindcss": "^3.4.1",
"typescript": "^5",
"unocss": "^0.60.2",
"unocss": "^0.60.4",
"unocss-preset-animations": "^1.0.2",
"unocss-preset-autoprefixer": "^0.0.7",
"unocss-preset-shadcn": "^0.3.0",
"vite": "^5.2.12",
"vite-tsconfig-paths": "^4.3.2",
"vitest": "^1.6.0"
}
Expand Down
22 changes: 9 additions & 13 deletions src/app/_components/ActAsDao.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import {
AccordionContent,
AccordionItem,
AccordionTrigger,
} from "@/common/ui/components/accordion";
import { Button } from "@/common/ui/components/button";
import { Checkbox } from "@/common/ui/components/checkbox";
import { DropdownMenuLabel } from "@/common/ui/components/dropdown-menu";
import { Input } from "@/common/ui/components/input";
import { Label } from "@/common/ui/components/label";
import { Switch } from "@/common/ui/components/switch";
Button,
Checkbox,
DropdownMenuLabel,
Input,
Label,
Switch,
} from "@/common/ui/components";
import { toggleDao } from "@/modules/profile/utils";

import { dispatch, useTypedSelector } from "../_store";
Expand All @@ -24,7 +24,7 @@ const ActAsDao = () => {
const [inputActive, setInputActive] = useState(false);

const { addresses, toggle, defaultAddress } = useTypedSelector(
(state) => state.nav,
(state) => state.nav.actAsDao,
);

const { markDaoAsDefault, addOrRemoveDaoAddress } = dispatch.nav;
Expand All @@ -41,11 +41,7 @@ const ActAsDao = () => {
alt="info"
/>
</Label>
<Switch
value={toggle}
id="act-dao"
onClick={() => toggleDao(!toggle)}
/>
<Switch id="act-dao" checked={toggle} onCheckedChange={toggleDao} />
</div>
<Accordion className="w-full" type="single" collapsible>
{addresses?.map((address: string) => (
Expand Down
20 changes: 11 additions & 9 deletions src/app/_components/AllProjects.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import React, { useEffect, useState } from "react";

import { useTypedSelector } from "@/app/_store";
import {
Registration,
RegistrationStatus,
} from "@/common/contracts/potlock/interfaces/lists.interfaces";
import { getRegistrations } from "@/common/contracts/potlock/lists";
import Filter, { Group } from "@/common/ui/components/Filter";
import InfiniteScroll from "@/common/ui/components/InfiniteScroll";
import SearchBar from "@/common/ui/components/SearchBar";
import SortSelect from "@/common/ui/components/SortSelect";
import {
Filter,
Group,
InfiniteScroll,
SearchBar,
SortSelect,
} from "@/common/ui/components";
import { Profile } from "@/modules/profile/models";

import Card from "../../modules/project/components/Card";
import { categories, statuses } from "../../modules/project/constants";
import { useTypedSelector } from "../_store";
import { ProjectCard } from "@/modules/project";
import { categories, statuses } from "@/modules/project/constants";

const MAXIMUM_CARDS_PER_INDEX = 9;

Expand Down Expand Up @@ -184,7 +186,7 @@ const AllProjects = () => {
setIndex={setIndex}
size={MAXIMUM_CARDS_PER_INDEX}
renderItem={(registration: Registration) => (
<Card
<ProjectCard
projectId={registration.registrant_id}
key={registration.id}
/>
Expand Down
4 changes: 2 additions & 2 deletions src/app/_components/FeaturedProjects.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Card from "@/modules/project/components/Card";
import { ProjectCard } from "@/modules/project";

const featuredProjectIds = [
"v1.foodbank.near",
Expand All @@ -17,7 +17,7 @@ const FeaturedProjects = () => {

<div className="grid w-full grid-cols-1 gap-8 md:grid-cols-2 lg:grid-cols-3">
{featuredProjectIds.map((projectId) => (
<Card key={projectId} projectId={projectId} />
<ProjectCard key={projectId} projectId={projectId} />
))}
</div>
</div>
Expand Down
7 changes: 3 additions & 4 deletions src/app/_components/Hero.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import Link from "next/link";

import { Button } from "@/common/ui/components/button";

import useWallet from "../../modules/auth/hooks/useWallet";
import useRegistration from "../../modules/core/hooks/useRegistration";
import { Button } from "@/common/ui/components";
import useWallet from "@/modules/auth/hooks/useWallet";
import useRegistration from "@/modules/core/hooks/useRegistration";

const Hero = () => {
const wallet = useWallet();
Expand Down
6 changes: 3 additions & 3 deletions src/app/_components/UserDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import { walletApi } from "@/common/contracts";
import { NEARSocialUserProfile } from "@/common/contracts/social";
import { getIsHuman } from "@/common/contracts/sybil.nadabot";
import { _address } from "@/common/lib";
import { Button } from "@/common/ui/components/button";
import {
Button,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuTrigger,
} from "@/common/ui/components/dropdown-menu";
import { Skeleton } from "@/common/ui/components/skeleton";
Skeleton,
} from "@/common/ui/components";
import useWallet from "@/modules/auth/hooks/useWallet";
import { statusesIcons } from "@/modules/core/constants";
import useRegistration from "@/modules/core/hooks/useRegistration";
Expand Down
4 changes: 2 additions & 2 deletions src/app/_layout/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import Link from "next/link";
import { usePathname } from "next/navigation";

import { walletApi } from "@/common/contracts";
import useIsClient from "@/common/hooks/useIsClient";
import { Button } from "@/common/ui/components/button";
import useIsClient from "@/common/lib/useIsClient";
import { Button } from "@/common/ui/components";
import { useAuth } from "@/modules/auth/hooks/useAuth";
import routesPath from "@/modules/core/routes";

Expand Down
Loading

0 comments on commit dbbd83a

Please sign in to comment.