From cd0eb3ba4e4806e7c22632bedcea008a59594fc4 Mon Sep 17 00:00:00 2001 From: sajee_techi Date: Wed, 16 Apr 2025 14:45:37 +0530 Subject: [PATCH 001/106] update config: update config of wallet.pay.brussels to include session attribute --- community.json | 87 ++++++--- src/services/config/communities.json | 202 ++++++++++---------- src/services/config/communities.local.json | 205 +++++++++++---------- 3 files changed, 274 insertions(+), 220 deletions(-) diff --git a/community.json b/community.json index d2f8442..cd2d6e1 100644 --- a/community.json +++ b/community.json @@ -1,30 +1,43 @@ { "community": { - "name": "Breadchain Community Token", - "description": "BREAD is a digital community token and solidarity primitive developed by Breadchain Cooperative that generates yield for post-capitalist organizations", - "url": "https://breadchain.xyz/", - "alias": "bread", - "logo": "https://bread.citizenwallet.xyz/uploads/logo.svg", + "name": "Brussels Pay", + "description": "A community for the city of Brussels", + "url": "https://pay.brussels", + "alias": "wallet.pay.brussels", + "logo": "https://assets.citizenwallet.xyz/wallet-config/_images/wallet.pay.brussels.png", + "custom_domain": "wallet.pay.brussels", + "hidden": false, + "theme": { + "primary": "#4a90e2" + }, "profile": { - "address": "0x6b3a1f4277391526413F583c23D5B9EF4d2fE986", + "address": "0x56Cc38bDa01bE6eC6D854513C995f6621Ee71229", "chain_id": 100 }, "primary_token": { - "address": "0xa555d5344f6fb6c65da19e403cb4c1ec4a1a5ee3", + "address": "0x5815E61eF72c9E6107b5c5A05FD121F334f7a7f1", "chain_id": 100 }, "primary_account_factory": { "address": "0x940Cbb155161dc0C4aade27a4826a16Ed8ca0cb2", "chain_id": 100 + }, + "primary_card_manager": { + "address": "0xBA861e2DABd8316cf11Ae7CdA101d110CF581f28", + "chain_id": 100 + }, + "primary_session_manager": { + "address": "0xE2F3DC3E638113b9496060349e5332963d9C1152", + "chain_id": 100 } }, "tokens": { - "100:0xa555d5344f6fb6c65da19e403cb4c1ec4a1a5ee3": { + "100:0x5815E61eF72c9E6107b5c5A05FD121F334f7a7f1": { "standard": "erc20", - "name": "Breadchain Community Token", - "address": "0xa555d5344f6fb6c65da19e403cb4c1ec4a1a5ee3", - "symbol": "BREAD", - "decimals": 18, + "name": "pay.brussels", + "address": "0x5815E61eF72c9E6107b5c5A05FD121F334f7a7f1", + "symbol": "EURb", + "decimals": 6, "chain_id": 100 } }, @@ -33,27 +46,48 @@ "name": "Gnosis Explorer" }, "accounts": { - "100:0xAE76B1C6818c1DD81E20ccefD3e72B773068ABc9": { + "100:0xBABCf159c4e3186cf48e4a48bC0AeC17CF9d90FE": { "chain_id": 100, - "entrypoint_address": "0xcA0a75EF803a364C83c5EAE7Eb889aE7419c9dF2", - "paymaster_address": "0xbE2Cb3358aa14621134e923B68b8429315368E32", - "account_factory_address": "0xAE76B1C6818c1DD81E20ccefD3e72B773068ABc9", + "entrypoint_address": "0xAAEb9DC18aDadae9b3aE7ec2b47842565A81113f", + "paymaster_address": "0xcA1B9EC1117340818C1c1fdd1B48Ea79E57C140F", + "account_factory_address": "0xBABCf159c4e3186cf48e4a48bC0AeC17CF9d90FE", "paymaster_type": "cw" }, "100:0x940Cbb155161dc0C4aade27a4826a16Ed8ca0cb2": { "chain_id": 100, "entrypoint_address": "0x7079253c0358eF9Fd87E16488299Ef6e06F403B6", - "paymaster_address": "0x5C41F1114AB13aF5d66bac485924D03556d0cd51", + "paymaster_address": "0xE69C843898E21C0E95eA7DD310cD850AAc0aB897", "account_factory_address": "0x940Cbb155161dc0C4aade27a4826a16Ed8ca0cb2", "paymaster_type": "cw-safe" } }, + "cards": { + "100:0x1EaF6B6A6967608aF6c77224f087b042095891EB": { + "chain_id": 100, + "address": "0x1EaF6B6A6967608aF6c77224f087b042095891EB", + "type": "classic" + }, + "100:0xBA861e2DABd8316cf11Ae7CdA101d110CF581f28": { + "chain_id": 100, + "instance_id": "brussels-pay", + "address": "0xBA861e2DABd8316cf11Ae7CdA101d110CF581f28", + "type": "safe" + } + }, + "sessions": { + "100:0xE2F3DC3E638113b9496060349e5332963d9C1152": { + "chain_id": 100, + "module_address": "0xE2F3DC3E638113b9496060349e5332963d9C1152", + "factory_address": "0xEd0cD3886b84369A0e29Db9a4480ADF5051c76C9", + "provider_address": "0xF3004A1690f97Cf5d307eDc5958a7F76b62f9FC9" + } + }, "chains": { "100": { "id": 100, "node": { - "url": "https://100.engine.citizenwallet.xyz", - "ws_url": "wss://100.engine.citizenwallet.xyz" + "url": "https://engine.pay.brussels", + "ws_url": "wss://engine.pay.brussels" } } }, @@ -63,17 +97,12 @@ "plugins": [ { "name": "Top Up", - "icon": "https://bread.citizenwallet.xyz/uploads/logo.svg", - "url": "https://topup.citizenspring.earth/bread", - "action": "topup" - }, - { - "name": "Market", - "icon": "https://bread.citizenwallet.xyz/uploads/logo.svg", - "url": "https://marketplace.citizenwallet.xyz/bread", - "launch_mode": "webview" + "icon": "https://assets.citizenwallet.xyz/wallet-config/_images/wallet.pay.brussels.png", + "url": "https://checkout.pay.brussels/topup", + "action": "topup", + "signature": true } ], - "config_location": "https://config.internal.citizenwallet.xyz/v4/bread.citizenwallet.xyz.json", + "config_location": "https://wallet.pay.brussels/config/community.json", "version": 4 } diff --git a/src/services/config/communities.json b/src/services/config/communities.json index 4a14a9f..0dac9e7 100644 --- a/src/services/config/communities.json +++ b/src/services/config/communities.json @@ -68,102 +68,114 @@ "config_location": "https://config.internal.citizenwallet.xyz/v4/ctzn.json", "version": 4 }, - { - "community": { - "name": "Brussels Pay", - "description": "Open and local payments for Brussels", - "url": "https://pay.brussels", - "alias": "wallet.pay.brussels", - "logo": "https://assets.citizenwallet.xyz/wallet-config/_images/wallet.pay.brussels.png", - "custom_domain": "wallet.pay.brussels", - "hidden": false, - "theme": { - "primary": "#4a90e2" - }, - "profile": { - "address": "0x56Cc38bDa01bE6eC6D854513C995f6621Ee71229", - "chain_id": 100 - }, - "primary_token": { - "address": "0x5815E61eF72c9E6107b5c5A05FD121F334f7a7f1", - "chain_id": 100 - }, - "primary_account_factory": { - "address": "0x940Cbb155161dc0C4aade27a4826a16Ed8ca0cb2", - "chain_id": 100 - }, - "primary_card_manager": { - "address": "0xBA861e2DABd8316cf11Ae7CdA101d110CF581f28", - "chain_id": 100 - } - }, - "tokens": { - "100:0x5815E61eF72c9E6107b5c5A05FD121F334f7a7f1": { - "standard": "erc20", - "name": "pay.brussels", - "address": "0x5815E61eF72c9E6107b5c5A05FD121F334f7a7f1", - "symbol": "EURb", - "decimals": 6, - "chain_id": 100 - } - }, - "scan": { - "url": "https://gnosisscan.io", - "name": "Gnosis Explorer" - }, - "accounts": { - "100:0xBABCf159c4e3186cf48e4a48bC0AeC17CF9d90FE": { - "chain_id": 100, - "entrypoint_address": "0xAAEb9DC18aDadae9b3aE7ec2b47842565A81113f", - "paymaster_address": "0xcA1B9EC1117340818C1c1fdd1B48Ea79E57C140F", - "account_factory_address": "0xBABCf159c4e3186cf48e4a48bC0AeC17CF9d90FE", - "paymaster_type": "cw" - }, - "100:0x940Cbb155161dc0C4aade27a4826a16Ed8ca0cb2": { - "chain_id": 100, - "entrypoint_address": "0x7079253c0358eF9Fd87E16488299Ef6e06F403B6", - "paymaster_address": "0xE69C843898E21C0E95eA7DD310cD850AAc0aB897", - "account_factory_address": "0x940Cbb155161dc0C4aade27a4826a16Ed8ca0cb2", - "paymaster_type": "cw-safe" - } - }, - "cards": { - "100:0x1EaF6B6A6967608aF6c77224f087b042095891EB": { - "chain_id": 100, - "address": "0x1EaF6B6A6967608aF6c77224f087b042095891EB", - "type": "classic" - }, - "100:0xBA861e2DABd8316cf11Ae7CdA101d110CF581f28": { - "chain_id": 100, - "instance_id": "brussels-pay", - "address": "0xBA861e2DABd8316cf11Ae7CdA101d110CF581f28", - "type": "safe" - } - }, - "chains": { - "100": { - "id": 100, - "node": { - "url": "https://engine.pay.brussels", - "ws_url": "wss://engine.pay.brussels" - } - } - }, - "ipfs": { - "url": "https://ipfs.internal.citizenwallet.xyz" - }, - "plugins": [ - { - "name": "Top Up", - "icon": "https://assets.citizenwallet.xyz/wallet-config/_images/wallet.pay.brussels.png", - "url": "https://checkout.pay.brussels/topup", - "action": "topup", - "signature": true - } - ], - "config_location": "https://wallet.pay.brussels/config/community.json", - "version": 4 + { + "community": { + "name": "Brussels Pay", + "description": "A community for the city of Brussels", + "url": "https://pay.brussels", + "alias": "wallet.pay.brussels", + "logo": "https://assets.citizenwallet.xyz/wallet-config/_images/wallet.pay.brussels.png", + "custom_domain": "wallet.pay.brussels", + "hidden": false, + "theme": { + "primary": "#4a90e2" + }, + "profile": { + "address": "0x56Cc38bDa01bE6eC6D854513C995f6621Ee71229", + "chain_id": 100 + }, + "primary_token": { + "address": "0x5815E61eF72c9E6107b5c5A05FD121F334f7a7f1", + "chain_id": 100 + }, + "primary_account_factory": { + "address": "0x940Cbb155161dc0C4aade27a4826a16Ed8ca0cb2", + "chain_id": 100 + }, + "primary_card_manager": { + "address": "0xBA861e2DABd8316cf11Ae7CdA101d110CF581f28", + "chain_id": 100 + }, + "primary_session_manager": { + "address": "0xE2F3DC3E638113b9496060349e5332963d9C1152", + "chain_id": 100 + } + }, + "tokens": { + "100:0x5815E61eF72c9E6107b5c5A05FD121F334f7a7f1": { + "standard": "erc20", + "name": "pay.brussels", + "address": "0x5815E61eF72c9E6107b5c5A05FD121F334f7a7f1", + "symbol": "EURb", + "decimals": 6, + "chain_id": 100 + } + }, + "scan": { + "url": "https://gnosisscan.io", + "name": "Gnosis Explorer" + }, + "accounts": { + "100:0xBABCf159c4e3186cf48e4a48bC0AeC17CF9d90FE": { + "chain_id": 100, + "entrypoint_address": "0xAAEb9DC18aDadae9b3aE7ec2b47842565A81113f", + "paymaster_address": "0xcA1B9EC1117340818C1c1fdd1B48Ea79E57C140F", + "account_factory_address": "0xBABCf159c4e3186cf48e4a48bC0AeC17CF9d90FE", + "paymaster_type": "cw" + }, + "100:0x940Cbb155161dc0C4aade27a4826a16Ed8ca0cb2": { + "chain_id": 100, + "entrypoint_address": "0x7079253c0358eF9Fd87E16488299Ef6e06F403B6", + "paymaster_address": "0xE69C843898E21C0E95eA7DD310cD850AAc0aB897", + "account_factory_address": "0x940Cbb155161dc0C4aade27a4826a16Ed8ca0cb2", + "paymaster_type": "cw-safe" + } + }, + "cards": { + "100:0x1EaF6B6A6967608aF6c77224f087b042095891EB": { + "chain_id": 100, + "address": "0x1EaF6B6A6967608aF6c77224f087b042095891EB", + "type": "classic" + }, + "100:0xBA861e2DABd8316cf11Ae7CdA101d110CF581f28": { + "chain_id": 100, + "instance_id": "brussels-pay", + "address": "0xBA861e2DABd8316cf11Ae7CdA101d110CF581f28", + "type": "safe" + } + }, + "sessions": { + "100:0xE2F3DC3E638113b9496060349e5332963d9C1152": { + "chain_id": 100, + "module_address": "0xE2F3DC3E638113b9496060349e5332963d9C1152", + "factory_address": "0xEd0cD3886b84369A0e29Db9a4480ADF5051c76C9", + "provider_address": "0xF3004A1690f97Cf5d307eDc5958a7F76b62f9FC9" + } + }, + "chains": { + "100": { + "id": 100, + "node": { + "url": "https://engine.pay.brussels", + "ws_url": "wss://engine.pay.brussels" + } + } + }, + "ipfs": { + "url": "https://ipfs.internal.citizenwallet.xyz" }, + "plugins": [ + { + "name": "Top Up", + "icon": "https://assets.citizenwallet.xyz/wallet-config/_images/wallet.pay.brussels.png", + "url": "https://checkout.pay.brussels/topup", + "action": "topup", + "signature": true + } + ], + "config_location": "https://wallet.pay.brussels/config/community.json", + "version": 4 + }, { "community": { "name": "Gratitude Token", diff --git a/src/services/config/communities.local.json b/src/services/config/communities.local.json index fcd9407..e26ee77 100644 --- a/src/services/config/communities.local.json +++ b/src/services/config/communities.local.json @@ -68,102 +68,115 @@ "config_location": "https://config.internal.citizenwallet.xyz/v4/ctzn.json", "version": 4 }, - { - "community": { - "name": "Brussels Pay", - "description": "A community for the city of Brussels", - "url": "https://pay.brussels", - "alias": "wallet.pay.brussels", - "logo": "https://assets.citizenwallet.xyz/wallet-config/_images/wallet.pay.brussels.png", - "custom_domain": "wallet.pay.brussels", - "hidden": false, - "theme": { - "primary": "#4a90e2" - }, - "profile": { - "address": "0x56Cc38bDa01bE6eC6D854513C995f6621Ee71229", - "chain_id": 100 - }, - "primary_token": { - "address": "0x5815E61eF72c9E6107b5c5A05FD121F334f7a7f1", - "chain_id": 100 - }, - "primary_account_factory": { - "address": "0x940Cbb155161dc0C4aade27a4826a16Ed8ca0cb2", - "chain_id": 100 - }, - "primary_card_manager": { - "address": "0xBA861e2DABd8316cf11Ae7CdA101d110CF581f28", - "chain_id": 100 - } - }, - "tokens": { - "100:0x5815E61eF72c9E6107b5c5A05FD121F334f7a7f1": { - "standard": "erc20", - "name": "pay.brussels", - "address": "0x5815E61eF72c9E6107b5c5A05FD121F334f7a7f1", - "symbol": "EURb", - "decimals": 6, - "chain_id": 100 - } - }, - "scan": { - "url": "https://gnosisscan.io", - "name": "Gnosis Explorer" - }, - "accounts": { - "100:0xBABCf159c4e3186cf48e4a48bC0AeC17CF9d90FE": { - "chain_id": 100, - "entrypoint_address": "0xAAEb9DC18aDadae9b3aE7ec2b47842565A81113f", - "paymaster_address": "0xcA1B9EC1117340818C1c1fdd1B48Ea79E57C140F", - "account_factory_address": "0xBABCf159c4e3186cf48e4a48bC0AeC17CF9d90FE", - "paymaster_type": "cw" - }, - "100:0x940Cbb155161dc0C4aade27a4826a16Ed8ca0cb2": { - "chain_id": 100, - "entrypoint_address": "0x7079253c0358eF9Fd87E16488299Ef6e06F403B6", - "paymaster_address": "0xE69C843898E21C0E95eA7DD310cD850AAc0aB897", - "account_factory_address": "0x940Cbb155161dc0C4aade27a4826a16Ed8ca0cb2", - "paymaster_type": "cw-safe" - } - }, - "cards": { - "100:0x1EaF6B6A6967608aF6c77224f087b042095891EB": { - "chain_id": 100, - "address": "0x1EaF6B6A6967608aF6c77224f087b042095891EB", - "type": "classic" - }, - "100:0xBA861e2DABd8316cf11Ae7CdA101d110CF581f28": { - "chain_id": 100, - "instance_id": "brussels-pay", - "address": "0xBA861e2DABd8316cf11Ae7CdA101d110CF581f28", - "type": "safe" - } - }, - "chains": { - "100": { - "id": 100, - "node": { - "url": "https://engine.pay.brussels", - "ws_url": "wss://engine.pay.brussels" - } - } - }, - "ipfs": { - "url": "https://ipfs.internal.citizenwallet.xyz" - }, - "plugins": [ - { - "name": "Top Up", - "icon": "https://assets.citizenwallet.xyz/wallet-config/_images/wallet.pay.brussels.png", - "url": "https://checkout.pay.brussels/topup", - "action": "topup", - "signature": true - } - ], - "config_location": "https://wallet.pay.brussels/config/community.json", - "version": 4 - }, + { + "community": { + "name": "Brussels Pay", + "description": "A community for the city of Brussels", + "url": "https://pay.brussels", + "alias": "wallet.pay.brussels", + "logo": "https://assets.citizenwallet.xyz/wallet-config/_images/wallet.pay.brussels.png", + "custom_domain": "wallet.pay.brussels", + "hidden": false, + "theme": { + "primary": "#4a90e2" + }, + "profile": { + "address": "0x56Cc38bDa01bE6eC6D854513C995f6621Ee71229", + "chain_id": 100 + }, + "primary_token": { + "address": "0x5815E61eF72c9E6107b5c5A05FD121F334f7a7f1", + "chain_id": 100 + }, + "primary_account_factory": { + "address": "0x940Cbb155161dc0C4aade27a4826a16Ed8ca0cb2", + "chain_id": 100 + }, + "primary_card_manager": { + "address": "0xBA861e2DABd8316cf11Ae7CdA101d110CF581f28", + "chain_id": 100 + }, + "primary_session_manager": { + "address": "0xE2F3DC3E638113b9496060349e5332963d9C1152", + "chain_id": 100 + } + }, + "tokens": { + "100:0x5815E61eF72c9E6107b5c5A05FD121F334f7a7f1": { + "standard": "erc20", + "name": "pay.brussels", + "address": "0x5815E61eF72c9E6107b5c5A05FD121F334f7a7f1", + "symbol": "EURb", + "decimals": 6, + "chain_id": 100 + } + }, + "scan": { + "url": "https://gnosisscan.io", + "name": "Gnosis Explorer" + }, + "accounts": { + "100:0xBABCf159c4e3186cf48e4a48bC0AeC17CF9d90FE": { + "chain_id": 100, + "entrypoint_address": "0xAAEb9DC18aDadae9b3aE7ec2b47842565A81113f", + "paymaster_address": "0xcA1B9EC1117340818C1c1fdd1B48Ea79E57C140F", + "account_factory_address": "0xBABCf159c4e3186cf48e4a48bC0AeC17CF9d90FE", + "paymaster_type": "cw" + }, + "100:0x940Cbb155161dc0C4aade27a4826a16Ed8ca0cb2": { + "chain_id": 100, + "entrypoint_address": "0x7079253c0358eF9Fd87E16488299Ef6e06F403B6", + "paymaster_address": "0xE69C843898E21C0E95eA7DD310cD850AAc0aB897", + "account_factory_address": "0x940Cbb155161dc0C4aade27a4826a16Ed8ca0cb2", + "paymaster_type": "cw-safe" + } + }, + "cards": { + "100:0x1EaF6B6A6967608aF6c77224f087b042095891EB": { + "chain_id": 100, + "address": "0x1EaF6B6A6967608aF6c77224f087b042095891EB", + "type": "classic" + }, + "100:0xBA861e2DABd8316cf11Ae7CdA101d110CF581f28": { + "chain_id": 100, + "instance_id": "brussels-pay", + "address": "0xBA861e2DABd8316cf11Ae7CdA101d110CF581f28", + "type": "safe" + } + }, + "sessions": { + "100:0xE2F3DC3E638113b9496060349e5332963d9C1152": { + "chain_id": 100, + "module_address": "0xE2F3DC3E638113b9496060349e5332963d9C1152", + "factory_address": "0xEd0cD3886b84369A0e29Db9a4480ADF5051c76C9", + "provider_address": "0xF3004A1690f97Cf5d307eDc5958a7F76b62f9FC9" + } + }, + "chains": { + "100": { + "id": 100, + "node": { + "url": "https://engine.pay.brussels", + "ws_url": "wss://engine.pay.brussels" + } + } + }, + "ipfs": { + "url": "https://ipfs.internal.citizenwallet.xyz" + }, + "plugins": [ + { + "name": "Top Up", + "icon": "https://assets.citizenwallet.xyz/wallet-config/_images/wallet.pay.brussels.png", + "url": "https://checkout.pay.brussels/topup", + "action": "topup", + "signature": true + } + ], + "config_location": "https://wallet.pay.brussels/config/community.json", + "version": 4 + } +, { "community": { "name": "Gratitude Token", From a67faec11c45bc8a18061b5a107ae7e81dd8ab1c Mon Sep 17 00:00:00 2001 From: sajee_techi Date: Wed, 16 Apr 2025 14:46:48 +0530 Subject: [PATCH 002/106] remove deprecated env --- .env.example | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.env.example b/.env.example index 2801ecc..0ad19ea 100644 --- a/.env.example +++ b/.env.example @@ -12,6 +12,4 @@ BUILD_OUTPUT='default' NEXT_PUBLIC_REOWN_PROJECT_ID="x" # Gnosis Scan -NEXT_PUBLIC_GNOSIS_SCAN_API_KEY='x' - -NEXT_PUBLIC_APP_BASE_URL='https://gratitude.citizenwallet.xyz' \ No newline at end of file +NEXT_PUBLIC_GNOSIS_SCAN_API_KEY='x' \ No newline at end of file From 2be1e56ca51c1fe3547df056bf43a10de24acd09 Mon Sep 17 00:00:00 2001 From: sajee_techi Date: Wed, 16 Apr 2025 16:09:45 +0530 Subject: [PATCH 003/106] auth page with email signin option --- src/app/signin/_components/signin-email.tsx | 39 +++++++++ src/app/signin/layout.tsx | 7 ++ src/app/signin/page.tsx | 87 +++++++++++++++++++++ 3 files changed, 133 insertions(+) create mode 100644 src/app/signin/_components/signin-email.tsx create mode 100644 src/app/signin/layout.tsx create mode 100644 src/app/signin/page.tsx diff --git a/src/app/signin/_components/signin-email.tsx b/src/app/signin/_components/signin-email.tsx new file mode 100644 index 0000000..d4dc002 --- /dev/null +++ b/src/app/signin/_components/signin-email.tsx @@ -0,0 +1,39 @@ +"use client"; + +import { Mail } from "lucide-react"; +import Link from "next/link"; +import { Config } from "@citizenwallet/sdk"; +import { cn } from "@/lib/utils"; + +interface SignInEmailProps { + config: Config; +} + +export default function SignInEmail({ config }: SignInEmailProps) { + const primaryColor = config.community.theme?.primary ?? "#000000"; + + const style = { + backgroundColor: `${primaryColor}1A`, // 10% opacity + borderColor: `${primaryColor}33`, // 20% opacity + color: primaryColor, + }; + + return ( + + + Sign in with Email + + ); +} diff --git a/src/app/signin/layout.tsx b/src/app/signin/layout.tsx new file mode 100644 index 0000000..b17fa11 --- /dev/null +++ b/src/app/signin/layout.tsx @@ -0,0 +1,7 @@ +export default function Layout({ children }: { children: React.ReactNode }) { +return ( +
+
{children}
+
+); +} diff --git a/src/app/signin/page.tsx b/src/app/signin/page.tsx new file mode 100644 index 0000000..e7e7a92 --- /dev/null +++ b/src/app/signin/page.tsx @@ -0,0 +1,87 @@ +import { CommunityConfig } from "@citizenwallet/sdk"; +import { getCommunityFromHeaders } from "@/services/config"; +import { headers } from "next/headers"; +import { Metadata } from "next"; +import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; +import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; +import SignInEmail from "./_components/signin-email"; + +export const dynamic = "force-dynamic"; + +export async function generateMetadata(): Promise { + const metadata: Metadata = { + title: "Citizen Wallet", + description: "The open source wallet for your community.", + icons: { + icon: "/favicon.ico", + }, + openGraph: { + title: "Citizen Wallet", + description: "The open source wallet for your community.", + images: ["/logo.png"], + }, + }; + + const headersList = await headers(); + + const config = await getCommunityFromHeaders(headersList); + if (!config) { + return metadata; + } + + metadata.title = config.community.name; + metadata.description = config.community.description; + metadata.openGraph = { + title: config.community.name, + description: config.community.description, + images: [config.community.logo], + type: "article", + }; + + return metadata; +} + +export default async function Page() { + const headersList = await headers(); + + const config = await getCommunityFromHeaders(headersList); + if (!config) { + return
Community not found
; + } + + const communityConfig = new CommunityConfig(config); + + const logoUrl = communityConfig.community.logo + const communityName = communityConfig.community.name + const tokenSymbol = communityConfig.primaryToken.symbol; + + return ( + +
+ + {logoUrl ? ( + + ) : ( + + {tokenSymbol} + + )} + + +

{communityName}

+
+ + + Sign In + + + + + +
+ ); +} From b4de95ae96863321abe43e0f7dd2fdb39ab7db4d Mon Sep 17 00:00:00 2001 From: sajee_techi Date: Wed, 16 Apr 2025 16:29:48 +0530 Subject: [PATCH 004/106] install shadcn form --- package-lock.json | 251 ++++++++++++++++++++++++++++++++----- package.json | 7 +- src/components/ui/form.tsx | 178 ++++++++++++++++++++++++++ 3 files changed, 402 insertions(+), 34 deletions(-) create mode 100644 src/components/ui/form.tsx diff --git a/package-lock.json b/package-lock.json index 68e4b69..fb18ef3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,11 +9,12 @@ "version": "0.2.0", "dependencies": { "@citizenwallet/sdk": "^2.0.75", + "@hookform/resolvers": "^5.0.1", "@radix-ui/react-avatar": "^1.0.4", "@radix-ui/react-dialog": "^1.1.2", - "@radix-ui/react-label": "^2.1.1", + "@radix-ui/react-label": "^2.1.3", "@radix-ui/react-scroll-area": "^1.0.5", - "@radix-ui/react-slot": "^1.0.2", + "@radix-ui/react-slot": "^1.2.0", "@radix-ui/react-tabs": "^1.0.4", "@radix-ui/react-toast": "^1.2.1", "@radix-ui/themes": "^3.0.5", @@ -34,10 +35,12 @@ "qr.js": "^0.0.0", "react": "19.0.0", "react-dom": "19.0.0", + "react-hook-form": "^7.55.0", "smartcontracts": "github:citizenwallet/smartcontracts#v0.0.109", "tailwind-merge": "^2.3.0", "tailwindcss-animate": "^1.0.7", "vaul": "^0.9.1", + "zod": "^3.24.2", "zustand": "^4.5.2" }, "devDependencies": { @@ -1956,6 +1959,18 @@ "integrity": "sha512-MDWhGtE+eHw5JW7lq4qhc5yRLS11ERl1c7Z6Xd0a58DozHES6EnNNwUWbMiG4J9Cgj053Bhk8zvlhFYKVhULwg==", "license": "MIT" }, + "node_modules/@hookform/resolvers": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@hookform/resolvers/-/resolvers-5.0.1.tgz", + "integrity": "sha512-u/+Jp83luQNx9AdyW2fIPGY6Y7NG68eN2ZW8FOJYL+M0i4s49+refdJdOp/A9n9HFQtQs3HIDHQvX3ZET2o7YA==", + "license": "MIT", + "dependencies": { + "@standard-schema/utils": "^0.3.0" + }, + "peerDependencies": { + "react-hook-form": "^7.55.0" + } + }, "node_modules/@humanwhocodes/config-array": { "version": "0.13.0", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", @@ -3239,6 +3254,24 @@ } } }, + "node_modules/@radix-ui/react-alert-dialog/node_modules/@radix-ui/react-slot": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.2.tgz", + "integrity": "sha512-YAKxaiGsSQJ38VzKH86/BPRC4rh+b1Jpa+JneA5LRE7skmLPNAyeG8kPJj/oo4STLvlrs8vkf/iYyc3A5stYCQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-arrow": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@radix-ui/react-arrow/-/react-arrow-1.1.2.tgz", @@ -3367,6 +3400,24 @@ } } }, + "node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.2.tgz", + "integrity": "sha512-YAKxaiGsSQJ38VzKH86/BPRC4rh+b1Jpa+JneA5LRE7skmLPNAyeG8kPJj/oo4STLvlrs8vkf/iYyc3A5stYCQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-compose-refs": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.1.tgz", @@ -3461,6 +3512,24 @@ } } }, + "node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-slot": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.2.tgz", + "integrity": "sha512-YAKxaiGsSQJ38VzKH86/BPRC4rh+b1Jpa+JneA5LRE7skmLPNAyeG8kPJj/oo4STLvlrs8vkf/iYyc3A5stYCQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-direction": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@radix-ui/react-direction/-/react-direction-1.1.0.tgz", @@ -3622,12 +3691,12 @@ } }, "node_modules/@radix-ui/react-label": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@radix-ui/react-label/-/react-label-2.1.1.tgz", - "integrity": "sha512-UUw5E4e/2+4kFMH7+YxORXGWggtY6sM8WIwh5RZchhLuUg2H1hc98Py+pr8HMz6rdaYrK2t296ZEjYLOCO5uUw==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-label/-/react-label-2.1.3.tgz", + "integrity": "sha512-zwSQ1NzSKG95yA0tvBMgv6XPHoqapJCcg9nsUBaQQ66iRBhZNhlpaQG2ERYYX4O4stkYFK5rxj5NsWfO9CS+Hg==", "license": "MIT", "dependencies": { - "@radix-ui/react-primitive": "2.0.1" + "@radix-ui/react-primitive": "2.0.3" }, "peerDependencies": { "@types/react": "*", @@ -3645,12 +3714,12 @@ } }, "node_modules/@radix-ui/react-label/node_modules/@radix-ui/react-primitive": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.1.tgz", - "integrity": "sha512-sHCWTtxwNn3L3fH8qAfnF3WbUZycW93SM1j3NFDzXBiz8D6F5UTTy8G1+WFEaiCdvCVRJWj6N2R4Xq6HdiHmDg==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.3.tgz", + "integrity": "sha512-Pf/t/GkndH7CQ8wE2hbkXA+WyZ83fhQQn5DDmwDiDo6AwN/fhaH8oqZ0jRjMrO2iaMhDi6P1HRx6AZwyMinY1g==", "license": "MIT", "dependencies": { - "@radix-ui/react-slot": "1.1.1" + "@radix-ui/react-slot": "1.2.0" }, "peerDependencies": { "@types/react": "*", @@ -3667,24 +3736,6 @@ } } }, - "node_modules/@radix-ui/react-label/node_modules/@radix-ui/react-slot": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.1.tgz", - "integrity": "sha512-RApLLOcINYJA+dMVbOju7MYv1Mb2EBp2nH4HdDzXTSyaR5optlm6Otrz1euW3HbdOR8UmmFK06TD+A9frYWv+g==", - "license": "MIT", - "dependencies": { - "@radix-ui/react-compose-refs": "1.1.1" - }, - "peerDependencies": { - "@types/react": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, "node_modules/@radix-ui/react-menu": { "version": "2.1.6", "resolved": "https://registry.npmjs.org/@radix-ui/react-menu/-/react-menu-2.1.6.tgz", @@ -3725,6 +3776,24 @@ } } }, + "node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-slot": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.2.tgz", + "integrity": "sha512-YAKxaiGsSQJ38VzKH86/BPRC4rh+b1Jpa+JneA5LRE7skmLPNAyeG8kPJj/oo4STLvlrs8vkf/iYyc3A5stYCQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-navigation-menu": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/@radix-ui/react-navigation-menu/-/react-navigation-menu-1.2.5.tgz", @@ -3821,6 +3890,24 @@ } } }, + "node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-slot": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.2.tgz", + "integrity": "sha512-YAKxaiGsSQJ38VzKH86/BPRC4rh+b1Jpa+JneA5LRE7skmLPNAyeG8kPJj/oo4STLvlrs8vkf/iYyc3A5stYCQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-popper": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.2.2.tgz", @@ -3924,6 +4011,24 @@ } } }, + "node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.2.tgz", + "integrity": "sha512-YAKxaiGsSQJ38VzKH86/BPRC4rh+b1Jpa+JneA5LRE7skmLPNAyeG8kPJj/oo4STLvlrs8vkf/iYyc3A5stYCQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-progress": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@radix-ui/react-progress/-/react-progress-1.1.2.tgz", @@ -4085,6 +4190,24 @@ } } }, + "node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-slot": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.2.tgz", + "integrity": "sha512-YAKxaiGsSQJ38VzKH86/BPRC4rh+b1Jpa+JneA5LRE7skmLPNAyeG8kPJj/oo4STLvlrs8vkf/iYyc3A5stYCQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-visually-hidden": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@radix-ui/react-visually-hidden/-/react-visually-hidden-1.1.2.tgz", @@ -4142,12 +4265,12 @@ } }, "node_modules/@radix-ui/react-slot": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.2.tgz", - "integrity": "sha512-YAKxaiGsSQJ38VzKH86/BPRC4rh+b1Jpa+JneA5LRE7skmLPNAyeG8kPJj/oo4STLvlrs8vkf/iYyc3A5stYCQ==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.2.0.tgz", + "integrity": "sha512-ujc+V6r0HNDviYqIK3rW4ffgYiZ8g5DEHrGJVk4x7kTlLXRDILnKX9vAUYeIsLOoDpDJ0ujpqMkjH4w2ofuo6w==", "license": "MIT", "dependencies": { - "@radix-ui/react-compose-refs": "1.1.1" + "@radix-ui/react-compose-refs": "1.1.2" }, "peerDependencies": { "@types/react": "*", @@ -4159,6 +4282,21 @@ } } }, + "node_modules/@radix-ui/react-slot/node_modules/@radix-ui/react-compose-refs": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.2.tgz", + "integrity": "sha512-z4eqJvfiNnFMHIIvXP3CY57y2WJs5g2v3X0zm9mEJkrkNv4rDxu+sg9Jh8EkXyeqBkB7SOcboo9dMVqhyrACIg==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-switch": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@radix-ui/react-switch/-/react-switch-1.1.3.tgz", @@ -4458,6 +4596,24 @@ } } }, + "node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.2.tgz", + "integrity": "sha512-YAKxaiGsSQJ38VzKH86/BPRC4rh+b1Jpa+JneA5LRE7skmLPNAyeG8kPJj/oo4STLvlrs8vkf/iYyc3A5stYCQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-visually-hidden": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@radix-ui/react-visually-hidden/-/react-visually-hidden-1.1.2.tgz", @@ -5000,6 +5156,12 @@ "@stablelib/wipe": "^1.0.1" } }, + "node_modules/@standard-schema/utils": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@standard-schema/utils/-/utils-0.3.0.tgz", + "integrity": "sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g==", + "license": "MIT" + }, "node_modules/@swc/counter": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz", @@ -11566,6 +11728,22 @@ "react": "^19.0.0" } }, + "node_modules/react-hook-form": { + "version": "7.55.0", + "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.55.0.tgz", + "integrity": "sha512-XRnjsH3GVMQz1moZTW53MxfoWN7aDpUg/GpVNc4A3eXRVNdGXfbzJ4vM4aLQ8g6XCUh1nIbx70aaNCl7kxnjog==", + "license": "MIT", + "engines": { + "node": ">=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/react-hook-form" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17 || ^18 || ^19" + } + }, "node_modules/react-is": { "version": "18.3.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", @@ -13811,6 +13989,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/zod": { + "version": "3.24.2", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.24.2.tgz", + "integrity": "sha512-lY7CDW43ECgW9u1TcT3IoXHflywfVqDYze4waEz812jR/bZ8FHDsl7pFQoSZTz5N+2NqRXs8GBwnAwo3ZNxqhQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, "node_modules/zustand": { "version": "4.5.6", "resolved": "https://registry.npmjs.org/zustand/-/zustand-4.5.6.tgz", diff --git a/package.json b/package.json index 5729759..98baad9 100644 --- a/package.json +++ b/package.json @@ -14,11 +14,12 @@ }, "dependencies": { "@citizenwallet/sdk": "^2.0.75", + "@hookform/resolvers": "^5.0.1", "@radix-ui/react-avatar": "^1.0.4", "@radix-ui/react-dialog": "^1.1.2", - "@radix-ui/react-label": "^2.1.1", + "@radix-ui/react-label": "^2.1.3", "@radix-ui/react-scroll-area": "^1.0.5", - "@radix-ui/react-slot": "^1.0.2", + "@radix-ui/react-slot": "^1.2.0", "@radix-ui/react-tabs": "^1.0.4", "@radix-ui/react-toast": "^1.2.1", "@radix-ui/themes": "^3.0.5", @@ -39,10 +40,12 @@ "qr.js": "^0.0.0", "react": "19.0.0", "react-dom": "19.0.0", + "react-hook-form": "^7.55.0", "smartcontracts": "github:citizenwallet/smartcontracts#v0.0.109", "tailwind-merge": "^2.3.0", "tailwindcss-animate": "^1.0.7", "vaul": "^0.9.1", + "zod": "^3.24.2", "zustand": "^4.5.2" }, "devDependencies": { diff --git a/src/components/ui/form.tsx b/src/components/ui/form.tsx new file mode 100644 index 0000000..4f02ae6 --- /dev/null +++ b/src/components/ui/form.tsx @@ -0,0 +1,178 @@ +"use client" + +import * as React from "react" +import * as LabelPrimitive from "@radix-ui/react-label" +import { Slot } from "@radix-ui/react-slot" +import { + Controller, + FormProvider, + useFormContext, + type ControllerProps, + type FieldPath, + type FieldValues, +} from "react-hook-form" + +import { cn } from "@/lib/utils" +import { Label } from "@/components/ui/label" + +const Form = FormProvider + +type FormFieldContextValue< + TFieldValues extends FieldValues = FieldValues, + TName extends FieldPath = FieldPath +> = { + name: TName +} + +const FormFieldContext = React.createContext( + {} as FormFieldContextValue +) + +const FormField = < + TFieldValues extends FieldValues = FieldValues, + TName extends FieldPath = FieldPath +>({ + ...props +}: ControllerProps) => { + return ( + + + + ) +} + +const useFormField = () => { + const fieldContext = React.useContext(FormFieldContext) + const itemContext = React.useContext(FormItemContext) + const { getFieldState, formState } = useFormContext() + + const fieldState = getFieldState(fieldContext.name, formState) + + if (!fieldContext) { + throw new Error("useFormField should be used within ") + } + + const { id } = itemContext + + return { + id, + name: fieldContext.name, + formItemId: `${id}-form-item`, + formDescriptionId: `${id}-form-item-description`, + formMessageId: `${id}-form-item-message`, + ...fieldState, + } +} + +type FormItemContextValue = { + id: string +} + +const FormItemContext = React.createContext( + {} as FormItemContextValue +) + +const FormItem = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => { + const id = React.useId() + + return ( + +
+ + ) +}) +FormItem.displayName = "FormItem" + +const FormLabel = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => { + const { error, formItemId } = useFormField() + + return ( +