Skip to content

Commit

Permalink
feat: prettier project
Browse files Browse the repository at this point in the history
  • Loading branch information
Javid Momeni committed Jul 1, 2024
1 parent ed581e0 commit 2a82038
Show file tree
Hide file tree
Showing 14 changed files with 244 additions and 242 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
extends: ['mantine'],
parserOptions: {
project: './tsconfig.json',
},
};
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,18 @@
"@types/node": "^20.14.9",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.14.1",
"@vitejs/plugin-basic-ssl": "^1.1.0",
"@vitejs/plugin-react": "^4.3.1",
"eslint": "^8.57.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^18.0.0",
"eslint-config-mantine": "^3.2.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.9.0",
"eslint-plugin-react": "^7.34.3",
"eslint-plugin-react-hooks": "^4.6.2",
"identity-obj-proxy": "^3.0.0",
"jsdom": "^24.1.0",
"postcss": "^8.4.39",
Expand Down
37 changes: 7 additions & 30 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,18 @@ import FooterMenu from './components/FooterMenu/FooterMenu';
import HeaderMenu from './components/HeaderMenu/HeaderMenu';
import { TonConnectUIProvider } from '@tonconnect/ui-react';



export default function App() {
// const user = WebApp.initDataUnsafe.user;
// const usertgid = user?.id;
return (
<React.StrictMode>
<TonConnectUIProvider manifestUrl="https://kc.rahomaskan.com/tonconnect-manifest.json">
<DirectionProvider initialDirection="rtl">
<MantineProvider
theme={theme}
forceColorScheme = 'dark'
>
{/* <Notifications /> */}
{/* <Container size={'xs'}>
<AppShell
header={{ height: 40 }}
footer={{ height: 70 }}
withBorder={false}
>
<AppShell.Header>
<HeaderMenu username={user?.username?? 'KC'} photoUrl={user?.photo_url?? 'https://kc.rahomaskan.com/assets/images/kharcoin.jpg'} />
</AppShell.Header>
<AppShell.Main>
<Router />
</AppShell.Main>
<AppShell.Footer>
<FooterMenu />
</AppShell.Footer>
</AppShell>
</Container> */}
<Router />
</MantineProvider>
</DirectionProvider>
<TonConnectUIProvider manifestUrl="https://kc.rahomaskan.com/tonconnect-manifest.json">
<DirectionProvider initialDirection="rtl">
<MantineProvider theme={theme} forceColorScheme="dark">
<Router />
</MantineProvider>
</DirectionProvider>
</TonConnectUIProvider>
</React.StrictMode>
);
}
}
4 changes: 2 additions & 2 deletions src/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ const router = createMemoryRouter([
]);

export function Router() {
return (<RouterProvider router={router} />);
}
return <RouterProvider router={router} />;
}
29 changes: 13 additions & 16 deletions src/components/FooterMenu/FooterMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import { Container, Flex, Tabs, UnstyledButton, rem } from '@mantine/core';
import { IconCoin, IconStar, IconFriends, IconCat, IconHome2, IconBolt, IconGift, IconDeer } from '@tabler/icons-react';
import {
IconCoin,
IconStar,
IconFriends,
IconCat,
IconHome2,
IconBolt,
IconGift,
IconDeer,
} from '@tabler/icons-react';
import { Link } from 'react-router-dom';
function FooterMenu() {
return (
<Container size={'xs'}>
<Flex
mih={70}
justify="center"
direction="row"
wrap="nowrap"
align="center"
>
<Flex mih={70} justify="center" direction="row" wrap="nowrap" align="center">
<Link to="/Earn">
<UnstyledButton
size="xs"
Expand All @@ -25,7 +28,6 @@ function FooterMenu() {
</UnstyledButton>
</Link>


<Link to="/Boosts">
<UnstyledButton
size="xs"
Expand All @@ -41,17 +43,13 @@ function FooterMenu() {
</Link>

<Link to="/Game">
<UnstyledButton
mr={'xl'}
ml={'xl'}
style={{ textAlign: 'center', color: 'white' }}
>
<UnstyledButton mr={'xl'} ml={'xl'} style={{ textAlign: 'center', color: 'white' }}>
<IconDeer style={{ width: rem(33), height: rem(33) }} />
<br />
بازی
</UnstyledButton>
</Link>

<Link to="/Friends">
<UnstyledButton
size="xs"
Expand All @@ -78,7 +76,6 @@ function FooterMenu() {
<br />
جایزه
</UnstyledButton>

</Link>
</Flex>
</Container>
Expand Down
37 changes: 13 additions & 24 deletions src/components/HeaderMenu/HeaderMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,24 @@ import { TonConnectButton } from '@tonconnect/ui-react';
function HeaderMenu({ username, photoUrl }: { username: string; photoUrl: string }) {
return (
<Container size={'xs'}>
<Flex
mih={60}
gap="xs"
justify="flex-end"
align="center"
direction="row"
>
<Avatar variant="filled" radius="xl" size="sm" color="yellow" src={photoUrl} alt={username} />
<UnstyledButton
mr={'xs'}
ml={'xs'}
style={{ textAlign: 'center', color: 'white' }}
>
<Flex mih={60} gap="xs" justify="flex-end" align="center" direction="row">
<Avatar
variant="filled"
radius="xl"
size="sm"
color="yellow"
src={photoUrl}
alt={username}
/>
<UnstyledButton mr={'xs'} ml={'xs'} style={{ textAlign: 'center', color: 'white' }}>
{username}
<IconAt style={{ width: rem(24), height: rem(24) }} />
<IconAt style={{ width: rem(24), height: rem(24) }} />
</UnstyledButton>
<UnstyledButton
mr={'xs'}
ml={'xs'}
style={{ textAlign: 'center', color: 'white' }}
>
<UnstyledButton mr={'xs'} ml={'xs'} style={{ textAlign: 'center', color: 'white' }}>
<IconUserShare style={{ width: rem(24), height: rem(24) }} />
</UnstyledButton>

<UnstyledButton
mr={'xs'}
ml={'xs'}
style={{ textAlign: 'center', color: 'white' }}
>
<UnstyledButton mr={'xs'} ml={'xs'} style={{ textAlign: 'center', color: 'white' }}>
{/* <IconWallet style={{ width: rem(24), height: rem(24) }} /> */}
<TonConnectButton />
</UnstyledButton>
Expand Down
11 changes: 6 additions & 5 deletions src/components/Welcome/Welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ export function Welcome() {
return (
<>
<Title className={classes.title} ta="center" mt={100}>
به {' '}
به{' '}
<Text inherit variant="gradient" component="span" gradient={{ from: 'pink', to: 'yellow' }}>
خرکوین
</Text>
{' '}خوش آمدید
خرکوین
</Text>{' '}
خوش آمدید
</Title>
<Text c="dimmed" ta="center" size="lg" maw={580} mx="auto" mt="xl">
اینجا همه چی خر تو خره! یه کم صبر کنید بازی کلیکی هم راه میندازیم که خرمون جفتک بندازه و خرکوین جمع کنیم
اینجا همه چی خر تو خره! یه کم صبر کنید بازی کلیکی هم راه میندازیم که خرمون جفتک بندازه و
خرکوین جمع کنیم
</Text>
</>
);
Expand Down
53 changes: 27 additions & 26 deletions src/pages/Boosts.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,43 +13,44 @@ export function BoostsPage() {

useEffect(() => {
if (userFriendlyAddress) {
const formdata = new FormData();
console.log(String(usertgid));
formdata.append("wallet", userFriendlyAddress);
formdata.append("id", String(usertgid));
const requestOptions = {
method: "POST",
body: formdata,
};
fetch("https://api.kharcoin.info/api/savewallet", requestOptions)
.then((response) => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.text(); // Assuming the response is text. Adjust accordingly.
})
.then((result) => console.log(result))
.catch((error) => console.error(error));
const formdata = new FormData();
console.log(String(usertgid));
formdata.append('wallet', userFriendlyAddress);
formdata.append('id', String(usertgid));

const requestOptions = {
method: 'POST',
body: formdata,
};
fetch('https://api.kharcoin.info/api/savewallet', requestOptions)
.then((response) => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.text(); // Assuming the response is text. Adjust accordingly.
})
.then((result) => console.log(result))
.catch((error) => console.error(error));
}
}, [userFriendlyAddress]);
return (
<Container size={'xs'}>
<AppShell
header={{ height: 40 }}
footer={{ height: 70 }}
withBorder={false}
>
<AppShell header={{ height: 40 }} footer={{ height: 70 }} withBorder={false}>
<AppShell.Header>
<HeaderMenu username={user?.username ?? 'KC'} photoUrl={user?.photo_url ?? 'https://bot.kharcoin.info/assets/images/kharcoin.jpg'} />
<HeaderMenu
username={user?.username ?? 'KC'}
photoUrl={user?.photo_url ?? 'https://bot.kharcoin.info/assets/images/kharcoin.jpg'}
/>
</AppShell.Header>
<AppShell.Main>
<Container>
<Title order={1}>تقویت</Title>
{userFriendlyAddress && (
<>
<>
<div>
<span>کیف پول شما برای بازی <br /> {userFriendlyAddress} <br /> است</span>
<span>
کیف پول شما برای بازی <br /> {userFriendlyAddress} <br /> است
</span>
</div>
</>
)}
Expand Down
Loading

0 comments on commit 2a82038

Please sign in to comment.