Skip to content

Commit

Permalink
feat: new dapp (#107)
Browse files Browse the repository at this point in the history
* feat: new dapp initial commit

* chore: add basePath

* feat: add Dockerfile and workflows

* chore: add comments to nginx.conf

* fix: update some configuration

* feat: new dapp

* fix: fixes linting issues

* feat: test

* feat: tailwind config

* feat: basic toggle theme component

* feat: welcome page

* feat: create initial navbar

* fix: change sizes on mobile

* feat: add footer for mobile view

* fix: changed landing page font sizes

* fix: fixes lintstaged

* chore: add team member (#106)

* Add team member

* chore: fix lint issue

Co-authored-by: martines3000 <domajnko.martin@gmail.com>

* fix: make some components more reusable

* feat: add connect Flask functionality

* feat: add dashboard card and connect spinner

* feat: query VCs

* fix: changed landing page

* feat: initial table

* feat: finish unstyled table

* fix: change VC id to hash of VC

* feat: add pagination, filter and select to table

* feat: data_store filter

* fix: change btn size

* feat: implement control bar

* feat: table design

* feat: table tooltips

* feat: finish table

* feat: create createVP page

* feat: view VC (JSON tab)

* feat: vc view

* fix: vc view

* feat: finish VC card

* feat: createVP page

* fix: fix formated tab banner design

* feat: created InputField & ToggleSwitch

* feat: added Delete and ModifyDataStore modals

* fix: add support for disabled VC stores

* feat: importVC modal & DropdownMultiselect comp

* fix: typo

* fix: change address button color

* fix: changed some icons and paddings

* feat: add tableCardView

* feat: new VC view

* feat: finished VC card

* chore: update readme (#110)

* chore: update veramo (#109)

* chore: update veramo and fix issues

* chore: skip Ceramic tests until fixed

* feat: return Result from onRpcRequest

* chore: uncomment tests and use it.skip instead

* feat: split utils into a seperate package

* chore: disable ceramic tests (#113)

* chore: disable ceramic tests until fixed

* chore: update deps (#112)

* chore: update deps and add package.json sort

* feat: added to VCCard

* fix: update Account popover

* feat: tooltip

* fix: add margin to tooltip

* feat: use new tooltip & add VCs view icons

* fix: make card view default

* fix: visual fixes

* feat: implement snap

* fix: vc selection bug

* feat: finish createVP page

* fix: change some visual bugs

* feat: add MenuPopover

* fix: remove cancle button from vpmodal

* chore: update pnpm-lock.yaml

* chore: remove eslint-disable for navigator.clipboard

* chore: remove useUrlQuery hook

* chore: small fix

* feat: add prettier improvements

* fix: use npm version of snap

* fix: remove unnecessary files & fix imports

* fix: replace classNames with clsx

* feat: update eslint rules

* fix: use public

* feat: fix fonts and images

* fix: image sizes

* fix: use zustand shallow

* fix: fix linting errors

* fix: saveVC

* feat: add toast & spinners

* fix: remove uneccessary vcStore calls

* fix: minor bugs

* fix: minor bugs

* fix: duplicate imports

* fix: bugfixes

* fix: build & linting issues

* chore: sonarcloud ignore test data

* chore: prettier

* fix: veramoUtils merge bug

* fix: fxies onRpcRequests

* fix: fixes some types, adds jsdoc comments

* feat: finish updating connector

* chore: remove ethereum.on()

* chore: undo unnecessary changes

* fix: undo broken vcmanager test:ci

* chore: update package.json

* fix: exclude website from build, lint, test steps

* fix: ignore website in CI

* feat: home background

* fix: style improvements

* fix: update tests, some jsdoc comments, errors

* fix: fix assertion issue

* fix: fixes tests

* chore: comment out code

* fix: fixes build issues and adds tsup

* fix: change tailwind colors

* feat: start working on dark mode

* fix: fix colors

* chore: add next/Head

* fix: fixes issue with method dropdown

* chore: todo and changes to toastStore

* feat: add prettier tailwindcss plugin

* fix: fixes lintstaged config for dapp

* chore: removes whitespace in classNames

* chore: remove unnecessary then

* chore: refactor navbar

* chore: update button

* fix: address popover overflow

* chore: refactor inputField

* chore: remove TODO

* fix: reuse navConnect

* chore: remove white space

* fix: update popover

* fix: use padding in home page

* chore: update elsintrc.cjs for dapp

* fix: rename and update gateways to providers

* chore: refactor react imports

* fix: fixes compiler warning

* fix: colors & style

* feat: improved connection handler

* fix: fix some styles

* feat: fix VC view

* fix: saveVC join results

* fix: start working on dark mode

* feat: dark mode

* fix: shadow

* feat: esm ssi-snap-types

* feat: esm connector

* fix: add readme to output

* fix: small fixes

* chore: update connector deps

* chore: lintstaged.cjs

* chore: more lintstaged.cjs

* chore: connector lintstaged.cjs

* fix: build

* feat: esm vcmanager and update configs

* feat: esm utils

* feat: update tests

* chore: deps

* fix: build dapp

* fix: docs

* fix: fixes config issues

* fix: fixes config issues

* fix: resolve last issues

* fix: add missing changeIsConnecting(false)

* fix: add missing import

* chore: remove double whitespace

* fix: fixed JIT & theme

* feat: esm ssi-snap-types

* feat: esm connector

* fix: add readme to output

* chore: update connector deps

* chore: lintstaged.cjs

* chore: more lintstaged.cjs

* chore: connector lintstaged.cjs

* feat: esm vcmanager and update configs

* feat: esm utils

* feat: update tests

* chore: deps

* fix: build dapp

* fix: docs

* fix: fixes config issues

* fix: fixes config issues

* fix: resolve last issues

* fix: fixes tests

* fix: fixes lintstagedrc

* chore: new lock file

* chore: fix issues

* chore: update tailwind.config.cjs

* fix: chanse base path to ssi-snap

* chore: fix lock file

* chore: add snap manifest

---------

Co-authored-by: Martin Domajnko <35891136+martines3000@users.noreply.github.com>
Co-authored-by: martines3000 <domajnko.martin@gmail.com>
  • Loading branch information
3 people authored and pseudobun committed Apr 6, 2023
1 parent fb7f759 commit 9f172ed
Show file tree
Hide file tree
Showing 89 changed files with 7,053 additions and 1,864 deletions.
6 changes: 5 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ module.exports = {
'WithStatement',
],
// for unused-imports library

'@typescript-eslint/no-unused-vars': 'off',
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
Expand All @@ -53,7 +54,6 @@ module.exports = {
argsIgnorePattern: '^_',
},
],
// for nestjs
'import/prefer-default-export': 0,
'class-methods-use-this': 'off',
// for tests
Expand All @@ -72,6 +72,7 @@ module.exports = {

// for prettier
'prettier/prettier': ['error', { singleQuote: true }],
'import/extensions': 'off',
},
ignorePatterns: [
'**/node_modules/**',
Expand All @@ -81,5 +82,8 @@ module.exports = {
'**/build/**',
'**/.docusaurus/**',
'**/next.config.js',
'**/out',
'**/.next',
'tsup.config.ts',
],
};
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ dist/
build/
coverage/
.cache/
public/
.yarn/patches

packages/docs/.docusaurus
Expand Down
9 changes: 8 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
"<THIRD_PARTY_MODULES>",
"",
"^types$",
"^@local/(.*)$",
"^@/lib/(.*)$",
"^@/components/(.*)$",
"^@/styles/(.*)$",
"^@/utils/(.*)$",
"^@/pages/(.*)$",
"^[./]"
],
"importOrderSeparation": false,
Expand All @@ -20,6 +26,7 @@
"importOrderCombineTypeAndValueImports": true,
"plugins": [
"prettier-plugin-packagejson",
"@ianvs/prettier-plugin-sort-imports"
"@ianvs/prettier-plugin-sort-imports",
"prettier-plugin-tailwindcss"
]
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"nx": "15.8.7",
"prettier": "^2.8.4",
"prettier-plugin-packagejson": "^2.4.3",
"prettier-plugin-tailwindcss": "^0.2.4",
"ts-node": "^10.9.1",
"typescript": "^4.9.5"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/connector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@blockchain-lab-um/ssi-snap-types": "*",
"@blockchain-lab-um/utils": "*",
"@metamask/detect-provider": "^2.0.0",
"@veramo/core": "^5.1.2"
"@veramo/core": "5.1.2"
},
"devDependencies": {
"@ianvs/prettier-plugin-sort-imports": "^3.7.1",
Expand Down
4 changes: 4 additions & 0 deletions packages/dapp/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ module.exports = {
project: './tsconfig.eslint.json',
sourceType: 'module',
},
rules: {
'@typescript-eslint/no-misused-promises': 0,
'global-require': 0,
},
};
1 change: 1 addition & 0 deletions packages/dapp/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist
node_modules
.next
out
2 changes: 1 addition & 1 deletion packages/dapp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ First, run the development server:
pnpm dev
```

Open [http://localhost:3000/dapp](http://localhost:3000/dapp) with your browser to see the result.
Open [http://localhost:3000/ssi-snap](http://localhost:3000/ssi-snap) with your browser to see the result.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

Expand Down
7 changes: 7 additions & 0 deletions packages/dapp/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
declare global {
interface Window {
ethereum: import('ethers').providers.ExternalProvider;
}
}

export {};
6 changes: 3 additions & 3 deletions packages/dapp/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import StylelintPlugin from 'stylelint-webpack-plugin';
const StylelintPlugin = require('stylelint-webpack-plugin');

// Content-Security-Policy
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
Expand All @@ -17,7 +17,7 @@ const isProd = process.env.NODE_ENV === 'production';
* @type {import('next').NextConfig}
*/
const nextConfig = {
// FIXME: On release change to /ssi-snap
// FIXME: On release change to /masca
basePath: '/dapp',
reactStrictMode: true,
swcMinify: true,
Expand Down Expand Up @@ -85,4 +85,4 @@ const nextConfig = {
},
};

export default nextConfig;
module.exports = nextConfig;
8 changes: 4 additions & 4 deletions packages/dapp/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ http {
listen 80;
root /app;
index index.html;
error_page 404 /dapp/404.html;
error_page 404 /ssi-snap/404.html;
absolute_redirect off;
rewrite ^/(.*)/$ /$1 permanent;

Expand All @@ -37,12 +37,12 @@ http {
add_header Cache-Control "public";
}

location = /dapp {
location = /ssi-snap {
gzip_static on;
try_files /dapp/index.html =404;
try_files /ssi-snap/index.html =404;
}

location /dapp/ {
location /ssi-snap/ {
gzip_static on;
try_files $uri $uri.html $uri/index.html $uri/ =404;
}
Expand Down
32 changes: 22 additions & 10 deletions packages/dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@blockchain-lab-um/dapp",
"version": "0.1.0",
"private": true,
"type": "module",
"type": "commonjs",
"scripts": {
"build": "next build",
"build:docker": "next export",
Expand All @@ -17,25 +17,37 @@
"start": "next start"
},
"dependencies": {
"@next/font": "13.1.6",
"@types/node": "18.15.3",
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
"@blockchain-lab-um/ssi-snap-connector": "*",
"@blockchain-lab-um/ssi-snap-types": "*",
"@blockchain-lab-um/utils": "*",
"@headlessui/react": "^1.7.7",
"@heroicons/react": "^2.0.13",
"@metamask/detect-provider": "^2.0.0",
"@radix-ui/react-toast": "^1.1.2",
"@tanstack/react-table": "^8.7.8",
"@veramo/core": "5.1.2",
"clsx": "^1.2.1",
"next": "13.1.6",
"ethers": "^6.0.8",
"next": "13.2.3",
"next-themes": "^0.2.1",
"prettier-plugin-tailwindcss": "^0.2.4",
"prop-types": "^15.8.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"zustand": "^4.3.3"
"tailwind-scrollbar": "^2.1.0",
"zustand": "^4.3.2"
},
"devDependencies": {
"@ianvs/prettier-plugin-sort-imports": "^3.7.1",
"@svgr/webpack": "^6.5.1",
"@types/eslint": "^8.21.1",
"@types/eslint": "^8",
"@types/node": "18.15.3",
"@types/prettier": "^2",
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
"autoprefixer": "^10.4.13",
"eslint": "^8.34.0",
"eslint-config-next": "^13.1.6",
"eslint": "^8.32.0",
"eslint-config-next": "^13.1.3",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-unused-imports": "^2.0.0",
Expand Down
Binary file added packages/dapp/public/images/ceramic_logo.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 packages/dapp/public/images/connect-spinner.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 packages/dapp/public/images/discord-mark-blue.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 packages/dapp/public/images/ssi_icon_b.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 packages/dapp/public/images/ssi_icon_w.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/dapp/sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ sonar.projectKey=blockchain-lab-um_dapp
sonar.projectName=blockchain-lab-um_dapp
sonar.sourceEncoding=UTF-8
sonar.sources=src
sonar.exclusions=**/node_modules/**,**/*spec.ts,**/*.e2e-spec.ts
sonar.exclusions=**/node_modules/**,**/*spec.ts,**/*.e2e-spec.ts,**/vc_data.ts
sonar.test.inclusions=**/*spec.ts,**/*.e2e-spec.ts
sonar.javascript.lcov.reportPaths=coverage/lcov.info
105 changes: 105 additions & 0 deletions packages/dapp/src/components/AddressPopover/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import React from 'react';
import { Popover, Transition } from '@headlessui/react';
import { ChevronDownIcon } from '@heroicons/react/20/solid';
import { DocumentDuplicateIcon } from '@heroicons/react/24/outline';

import { copyToClipboard } from '@/utils/string';

type AddressPopoverProps = {
address: string;
did: string;
disconnect: () => void;
};
const AddressPopover = ({ address, did, disconnect }: AddressPopoverProps) => {
return (
<Popover className="relative z-50">
{({ open }) => (
<>
<Popover.Button
className={`text-h4 animated-transition dark:bg-orange-accent-dark dark:text-navy-blue-900 rounded-3xlpx-4 font-ubuntu inline-flex w-full justify-center rounded-full bg-pink-100 py-2.5 px-7 font-normal text-gray-800 hover:opacity-80 focus:outline-none dark:border-none ${
open ? 'opacity-80' : ''
}`}
>
<div className="flex">
{`${address.slice(0, 5)}...${address.slice(-4)}`}

<ChevronDownIcon
className={`animated-transition -mr-1 ml-2 h-5 w-5 max-md:rotate-180 ${
open ? 'rotate-180' : ''
}`}
/>
</div>
</Popover.Button>
<Transition
enter="transition duration-100 ease-out"
enterFrom="transform scale-95 opacity-0"
enterTo="transform scale-100 opacity-100"
leave="transition duration-75 ease-out"
leaveFrom="transform scale-100 opacity-100"
leaveTo="transform scale-95 opacity-0"
>
<Popover.Panel className="dark:bg-navy-blue-500 absolute right-0 rounded-2xl bg-white shadow-xl max-md:-top-12 max-md:mb-2 max-md:-translate-y-full max-md:transform md:mt-2">
<div className="rounded-2xl px-6 pt-6 pb-3 shadow-sm">
<div className="flex flex-col justify-between gap-3">
<div>
<div className="dark:text-navy-blue-100 text-sm text-gray-700">
DID
</div>
<div className="mt-2 flex items-center">
<div className="text-2xl text-gray-900 dark:text-white">{`${did.substring(
0,
did.lastIndexOf(':')
)}:${did
.split(':')
[did.split(':').length - 1].slice(0, 5)}...${did.slice(
-4
)}`}</div>
<button
onClick={() => {
copyToClipboard(did);
}}
>
<DocumentDuplicateIcon className="animated-transition dark:text-navy-blue-50 ml-1 h-5 w-5 text-gray-900 hover:text-gray-600" />
</button>
</div>
</div>
<div>
<div className="dark:text-navy-blue-100 mt-4 text-sm text-gray-700">
CONNECTED WITH METAMASK
</div>
<div className="mt-2 flex items-center">
<div className="mr-1 mt-0.5">
<div className="h-2.5 w-2.5 rounded-full bg-green-500"></div>
</div>
<div className="text-lg text-gray-900 dark:text-white">{`${address.slice(
0,
5
)}...${address.slice(-4)}`}</div>
<button
onClick={() => {
copyToClipboard(address);
}}
>
<DocumentDuplicateIcon className="animated-transition dark:text-navy-blue-50 ml-1 h-5 w-5 text-gray-900 hover:text-gray-600" />
</button>
</div>
</div>
<div className="mt-2 flex justify-start">
<button
onClick={disconnect}
className="animated-transition mt-auto text-xs font-semibold text-pink-800 hover:text-pink-700 dark:text-pink-300 hover:dark:text-pink-400"
>
DISCONNECT
</button>
</div>
</div>
</div>
</Popover.Panel>
</Transition>
</>
)}
</Popover>
);
};

export default AddressPopover;
Loading

0 comments on commit 9f172ed

Please sign in to comment.