feat: started working with api
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
"use client";
|
||||
import { Block } from "@/components/Block";
|
||||
import { Page } from "@/components/Page";
|
||||
import { useState } from "react";
|
||||
import { useRawInitData } from "@telegram-apps/sdk-react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { getUrl } from "./actions";
|
||||
|
||||
export default function Home() {
|
||||
const initData = useRawInitData();
|
||||
const onCopyClick = async () => {
|
||||
await navigator.clipboard.writeText(window.location.href);
|
||||
setIsCopied(true);
|
||||
@@ -12,12 +15,28 @@ export default function Home() {
|
||||
}, 2000);
|
||||
};
|
||||
const [isCopied, setIsCopied] = useState(false);
|
||||
useEffect(() => {
|
||||
const fetchData = async () => {
|
||||
const data = await getUrl(initData);
|
||||
console.log(data);
|
||||
};
|
||||
fetchData();
|
||||
}, [initData]);
|
||||
return (
|
||||
<Page back={false}>
|
||||
<header className="flex h-12 w-full flex-col items-center justify-center bg-[var(--tg-theme-header-bg-color)]">
|
||||
<span className="text-xl font-semibold text-[var(--tg-theme-text-color)]">Nwaifu Proxy</span>
|
||||
</header>
|
||||
<main className="flex h-full w-full flex-col items-center gap-3 px-2.5 py-3.5 text-[var(--tg-theme-text-color)]">
|
||||
<main className="absolute bottom-0 left-0 flex w-full flex-col items-center gap-3 px-2.5 py-3.5 text-[var(--tg-theme-text-color)]">
|
||||
<Block name="Ссылка">
|
||||
<div className="size-44 rounded-md bg-white"></div>
|
||||
<button
|
||||
className="h-8 w-48 rounded-md bg-[var(--tg-theme-button-color)] text-[var(--tg-theme-button-text-color)] transition-[scale] hover:scale-[110%] active:scale-[115%]"
|
||||
onClick={onCopyClick}
|
||||
>
|
||||
{isCopied ? "Скопировано!" : "Копировать"}
|
||||
</button>
|
||||
</Block>
|
||||
<Block name="Подписка">
|
||||
<div className="flex flex-col items-center gap-0.5">
|
||||
<span>Статус:</span>
|
||||
@@ -28,15 +47,6 @@ export default function Home() {
|
||||
<span>01.01.2023</span>
|
||||
</div>
|
||||
</Block>
|
||||
<Block name="Ссылка">
|
||||
<div className="size-44 rounded-md bg-white"></div>
|
||||
<button
|
||||
className="mt-4 h-8 w-48 rounded-md bg-[var(--tg-theme-button-color)] text-[var(--tg-theme-button-text-color)] transition-[scale] hover:scale-[110%] active:scale-[115%]"
|
||||
onClick={onCopyClick}
|
||||
>
|
||||
{isCopied ? "Скопировано!" : "Копировать"}
|
||||
</button>
|
||||
</Block>
|
||||
</main>
|
||||
</Page>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user