Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pathname to route to different version #1

Merged
merged 3 commits into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "proposal-manager",
"private": true,
"version": "0.0.0",
"version": "0.1.0",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down Expand Up @@ -51,7 +51,7 @@
"@types/node": "^22.13.1",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"@vitejs/plugin-react": "^4.3.4",
"@vitejs/plugin-react-swc": "^3.8.0",
"autoprefixer": "^10.4.20",
"eslint": "^9.17.0",
"eslint-config-prettier": "^10.0.1",
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/components/CreateProposalCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { ProposalManagerQueryClient } from '@/__generated__/ProposalManager.clie
import { Coin } from '@/__generated__/ProposalManager.types';
import { useAllNativeTokenBalances } from '@/hooks/useAllNativeTokenBalances';
import { useCreateProposalMutation } from '@/hooks/useCreateProposalMutation';
import { isLoveApp } from '@/lib/utils.ts';
import { Button } from '@/shadcn/components/ui/button';
import {
Card,
Expand Down Expand Up @@ -211,7 +212,7 @@ export const CreateProposalCard: React.FC<Props> = ({ onSuccess }) => {
className="font-mono"
type="string"
id="title"
placeholder="Marry me"
placeholder={isLoveApp() ? 'Marry me' : "Let's collaborate!"}
value={title}
onChange={(e) => setTitle(e.target.value)}
/>
Expand All @@ -222,7 +223,7 @@ export const CreateProposalCard: React.FC<Props> = ({ onSuccess }) => {
className="font-mono"
type="string"
id="speech"
placeholder="I love you"
placeholder={isLoveApp() ? 'I love you' : 'Deal! Delay no more!'}
value={speech}
onChange={(e) => setSpeech(e.target.value)}
/>
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/components/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useCosmWasmClients, useMantra } from '@mantrachain/connect';
import { useQuery } from '@tanstack/react-query';

import { ProposalManagerQueryClient } from '@/__generated__/ProposalManager.client';
import { isLoveApp } from '@/lib/utils.ts';
import {
Tabs,
TabsContent,
Expand Down Expand Up @@ -78,10 +79,11 @@ export const Main = () => {
return (
<div className="container">
<h1 className="text-4xl font-semibold text-center mt-10">
Love on the Chain
{isLoveApp() ? 'Love on the Chain ❤️' : 'Make a deal on chain'}
</h1>
<p className="text-sm text-center mt-3">
Express your love on Mantra Chain!{' '}
{isLoveApp() ? 'Express your love' : 'Manage your proposals'} on Mantra
Chain!{' '}
<span className="text-pink-400">Create or respond to proposals</span>{' '}
with a gift of tokens.
</p>
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ import { twMerge } from 'tailwind-merge';
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}

export function isLoveApp() {
// 💖-> %F0%9F%92%96
return window.location.pathname.includes('%F0%9F%92%96');
}
2 changes: 1 addition & 1 deletion frontend/src/utils/getAppConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ export const getAppConfig = () => {
isMainnet: import.meta.env.VITE_NETWORK === 'mainnet',
proposalContractAddress:
import.meta.env.VITE_PROPOSAL_MANAGER_ADDRESS ||
'mantra17p9u09rgfd2nwr52ayy0aezdc42r2xd2g5d70u00k5qyhzjqf89q08tazu2',
'mantra17p9u09rgfd2nwr52ayy0aezdc42r2xd2g5d70u00k5qyhzjqf89q08tazu',
};
};
2 changes: 1 addition & 1 deletion frontend/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import react from '@vitejs/plugin-react';
import react from '@vitejs/plugin-react-swc';
import path from 'path';
import { defineConfig } from 'vite';
import { nodePolyfills } from 'vite-plugin-node-polyfills';
Expand Down
88 changes: 88 additions & 0 deletions frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3497,13 +3497,94 @@
resolved "https://registry.yarnpkg.com/@storybook/theming/-/theming-8.6.2.tgz#e4bfd25ef19a38cebe96786d8c60ada889f02419"
integrity sha512-NF7tMZBbmh6rNf+uw5wVUpsVIwnbhLgauhQJONuQ8i+cI6cJEBaKjIC2uMWUBABqnj1LqGrHSEWVeeYwuAeUYg==

"@swc/[email protected]":
version "1.11.7"
resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.11.7.tgz#bd52d6e6ae5b7e458e3b0507bebd3b90f1b3516f"
integrity sha512-3+LhCP2H50CLI6yv/lhOtoZ5B/hi7Q/23dye1KhbSDeDprLTm/KfLJh/iQqwaHUponf5m8C2U0y6DD+HGLz8Yw==

"@swc/[email protected]":
version "1.11.7"
resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.11.7.tgz#79871970698868f08c986d5ed1099dd441add24e"
integrity sha512-1diWpJqwX1XmOghf9ENFaeRaTtqLiqlZIW56RfOqmeZ7tPp3qS7VygWb9akptBsO5pEA5ZwNgSerD6AJlQcjAw==

"@swc/[email protected]":
version "1.11.7"
resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.11.7.tgz#cf48e89c78154796a973b544d458d83e650ece64"
integrity sha512-MV8+hLREf0NN23NuSKemsjFaWjl/HnqdOkE7uhXTnHzg8WTwp6ddVtU5Yriv15+d/ktfLWPVAOhLHQ4gzaoa8A==

"@swc/[email protected]":
version "1.11.7"
resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.11.7.tgz#d478d5c824565e5692c5715716d126f2d469c928"
integrity sha512-5GNs8ZjHQy/UTSnzzn+gm1RCUpCYo43lsxYOl8mpcnZSfxkNFVpjfylBv0QuJ5qhdfZ2iU55+v4iJCwCMtw0nA==

"@swc/[email protected]":
version "1.11.7"
resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.11.7.tgz#f0922a71e7e11d6c7f3942cb6ebd2864d6bbed5c"
integrity sha512-cTydaYBwDbVV5CspwVcCp9IevYWpGD1cF5B5KlBdjmBzxxeWyTAJRtKzn8w5/UJe/MfdAptarpqMPIs2f33YEQ==

"@swc/[email protected]":
version "1.11.7"
resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.11.7.tgz#dbcfa1f0327ca2c187ea61dfb7469dad1f815a7d"
integrity sha512-YAX2KfYPlbDsnZiVMI4ZwotF3VeURUrzD+emJgFf1g26F4eEmslldgnDrKybW7V+bObsH22cDqoy6jmQZgpuPQ==

"@swc/[email protected]":
version "1.11.7"
resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.11.7.tgz#f6cc8de75f778864d8ce310e834c9a027ebb8a49"
integrity sha512-mYT6FTDZyYx5pailc8xt6ClS2yjKmP8jNHxA9Ce3K21n5qkKilI5M2N7NShwXkd3Ksw3F29wKrg+wvEMXTRY/A==

"@swc/[email protected]":
version "1.11.7"
resolved "https://registry.yarnpkg.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.11.7.tgz#9a4106abaf3a5fc1d3c909ab46288306c8047e54"
integrity sha512-uLDQEcv0BHcepypstyxKkNsW6KfLyI5jVxTbcxka+B2UnMcFpvoR87nGt2JYW0grO2SNZPoFz+UnoKL9c6JxpA==

"@swc/[email protected]":
version "1.11.7"
resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.11.7.tgz#fc872ae6e716da0c90ebe6203b7d28baea449ff3"
integrity sha512-wiq5G3fRizdxAJVFcon7zpyfbfrb+YShuTy+TqJ4Nf5PC0ueMOXmsmeuyQGApn6dVWtGCyymYQYt77wHeQajdA==

"@swc/[email protected]":
version "1.11.7"
resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.11.7.tgz#164376daaf488cfa49db4ffe749d22585c984897"
integrity sha512-/zQdqY4fHkSORxEJ2cKtRBOwglvf/8gs6Tl4Q6VMx2zFtFpIOwFQstfY5u8wBNN2Z+PkAzyUCPoi8/cQFK8HLQ==

"@swc/core@^1.10.15":
version "1.11.7"
resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.11.7.tgz#f955519097d92860ae2fa5a3b45b7ba148c66834"
integrity sha512-ICuzjyfz8Hh3U16Mb21uCRJeJd/lUgV999GjgvPhJSISM1L8GDSB5/AMNcwuGs7gFywTKI4vAeeXWyCETUXHAg==
dependencies:
"@swc/counter" "^0.1.3"
"@swc/types" "^0.1.19"
optionalDependencies:
"@swc/core-darwin-arm64" "1.11.7"
"@swc/core-darwin-x64" "1.11.7"
"@swc/core-linux-arm-gnueabihf" "1.11.7"
"@swc/core-linux-arm64-gnu" "1.11.7"
"@swc/core-linux-arm64-musl" "1.11.7"
"@swc/core-linux-x64-gnu" "1.11.7"
"@swc/core-linux-x64-musl" "1.11.7"
"@swc/core-win32-arm64-msvc" "1.11.7"
"@swc/core-win32-ia32-msvc" "1.11.7"
"@swc/core-win32-x64-msvc" "1.11.7"

"@swc/counter@^0.1.3":
version "0.1.3"
resolved "https://registry.yarnpkg.com/@swc/counter/-/counter-0.1.3.tgz#cc7463bd02949611c6329596fccd2b0ec782b0e9"
integrity sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==

"@swc/helpers@^0.5.0":
version "0.5.15"
resolved "https://registry.yarnpkg.com/@swc/helpers/-/helpers-0.5.15.tgz#79efab344c5819ecf83a43f3f9f811fc84b516d7"
integrity sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==
dependencies:
tslib "^2.8.0"

"@swc/types@^0.1.19":
version "0.1.19"
resolved "https://registry.yarnpkg.com/@swc/types/-/types-0.1.19.tgz#65d9fe81e0a1dc7e861ad698dd581abe3703a2d2"
integrity sha512-WkAZaAfj44kh/UFdAQcrMP1I0nwRqpt27u+08LMBYMqmQfwwMofYoMh/48NGkMMRfC4ynpfwRbJuu8ErfNloeA==
dependencies:
"@swc/counter" "^0.1.3"

"@tanstack/eslint-plugin-query@^5.66.0":
version "5.66.0"
resolved "https://registry.yarnpkg.com/@tanstack/eslint-plugin-query/-/eslint-plugin-query-5.66.0.tgz#c4537d62ca8bb94fbd7f0b1323053b03a79b39b0"
Expand Down Expand Up @@ -3910,6 +3991,13 @@
resolved "https://registry.yarnpkg.com/@vanilla-extract/recipes/-/recipes-0.5.5.tgz#da34e247be2c3d70e01ecfeb53310daadc608b74"
integrity sha512-VadU7+IFUwLNLMgks29AHav/K5h7DOEfTU91RItn5vwdPfzduodNg317YbgWCcpm7FSXkuR3B3X8ZOi95UOozA==

"@vitejs/plugin-react-swc@^3.8.0":
version "3.8.0"
resolved "https://registry.yarnpkg.com/@vitejs/plugin-react-swc/-/plugin-react-swc-3.8.0.tgz#3af56d6dbfe3734e2970d8b9345f261353e2d676"
integrity sha512-T4sHPvS+DIqDP51ifPqa9XIRAz/kIvIi8oXcnOZZgHmMotgmmdxe/DD5tMFlt5nuIRzT0/QuiwmKlH0503Aapw==
dependencies:
"@swc/core" "^1.10.15"

"@vitejs/plugin-react@^4.3.4":
version "4.3.4"
resolved "https://registry.yarnpkg.com/@vitejs/plugin-react/-/plugin-react-4.3.4.tgz#c64be10b54c4640135a5b28a2432330e88ad7c20"
Expand Down
Loading