|
1 | | -import { useQuery } from '@tanstack/react-query' |
| 1 | +import { Link } from 'react-router' |
| 2 | +import SettingsIcon from './assets/settings' |
2 | 3 | import XEN_IMAGE from './assets/xen-anime-style-portrait.png' |
3 | 4 | import Capabilities from './components/Capabilities' |
4 | | -import DeveloperMode from './components/DeveloperMode' |
5 | | -import FooterMenu from './components/FooterMenu' |
6 | 5 | import Layout from './components/Layout' |
7 | | -import ThemeButton from './components/ThemeButton' |
8 | 6 | import Wallet from './components/Wallet' |
9 | | -import Warnings from './components/Warnings' |
10 | | -import { TMemory } from './types' |
11 | | -import { API_URL } from './env' |
12 | | - |
13 | | -const queryFn = (name: string, params?: { [key: string]: string | number }) => async () => { |
14 | | - if (!window.Telegram.WebApp.initData) { |
15 | | - throw new Error('Telegram is not available') |
16 | | - } |
17 | | - const response = await fetch(API_URL, { |
18 | | - method: 'POST', |
19 | | - headers: { |
20 | | - Authorization: `Bearer ${window.Telegram.WebApp.initData}`, |
21 | | - 'Content-Type': 'application/json', |
22 | | - }, |
23 | | - body: JSON.stringify({ |
24 | | - jsonrpc: '2.0', |
25 | | - method: name, |
26 | | - params: params ?? {}, |
27 | | - id: 1, |
28 | | - }), |
29 | | - }) |
30 | | - if (!response.ok) { |
31 | | - throw new Error('Network response was not ok') |
32 | | - } |
33 | | - const data = await response.json() |
34 | | - return data.result |
35 | | -} |
36 | 7 |
|
37 | 8 | function App() { |
38 | | - const { data: memories } = useQuery<{ items: TMemory[]; total: number }>({ |
39 | | - queryKey: ['memories'], |
40 | | - queryFn: queryFn('getMemories', { |
41 | | - offset: 0, |
42 | | - limit: 10, |
43 | | - }), |
44 | | - }) |
45 | | - |
46 | 9 | return ( |
47 | 10 | <Layout> |
48 | | - <div className="absolute top-5 right-4"> |
49 | | - <ThemeButton /> |
50 | | - </div> |
| 11 | + <Link |
| 12 | + to="/settings" |
| 13 | + className="absolute top-5 right-4 rounded-full border border-[#f8f9ff19] bg-(--color-light-white-bg) p-2 backdrop-blur-3xl backdrop-opacity-80" |
| 14 | + > |
| 15 | + <SettingsIcon /> |
| 16 | + </Link> |
51 | 17 | <div className="z-1 m-2.5 flex w-[210px] justify-center overflow-hidden rounded-full select-none"> |
52 | 18 | <img src={XEN_IMAGE} alt="xen-photo" className="h-full w-full" /> |
53 | 19 | </div> |
54 | 20 | <Wallet /> |
55 | 21 | <Capabilities /> |
56 | | - <DeveloperMode /> |
57 | | - <Warnings /> |
58 | | - <div className="fixed top-[calc(100vh-94px)] left-1/2 z-1 -translate-x-1/2"> |
59 | | - <FooterMenu memoriesNumber={memories?.total} /> |
60 | | - </div> |
61 | 22 | </Layout> |
62 | 23 | ) |
63 | 24 | } |
|
0 commit comments