Skip to content

Commit

Permalink
Merge pull request #22 from Scondic/GL-00
Browse files Browse the repository at this point in the history
GL-00: восстановление билда проекта
  • Loading branch information
Scondic authored May 10, 2024
2 parents f01e977 + 67c59ad commit 575a45c
Show file tree
Hide file tree
Showing 29 changed files with 266 additions and 406 deletions.
14 changes: 7 additions & 7 deletions src/app/auth/signin/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Link from 'next/link';
import Link from "next/link";

import { SignInForm } from '@/features/auth-credentials-form';
import { cn } from '@/shared/lib/utils';
import { AUTH_PAGES } from '@/shared/routes';
import { buttonVariants } from '@/shared/ui/button';
import { SignInForm } from "../../../features/auth-credentials-form";
import { cn } from "../../../shared/lib/utils";
import { AUTH_PAGES } from "../../../shared/routes";
import { buttonVariants } from "../../../shared/ui/button";

export default function SignInPage() {
return (
Expand All @@ -12,8 +12,8 @@ export default function SignInPage() {
<Link
href={AUTH_PAGES.SIGN_UP}
className={cn(
buttonVariants({ variant: 'ghost' }),
'absolute right-4 top-4 md:right-8 md:top-8',
buttonVariants({ variant: "ghost" }),
"absolute right-4 top-4 md:right-8 md:top-8",
)}
>
Регистрация
Expand Down
14 changes: 7 additions & 7 deletions src/app/auth/signup/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Link from 'next/link';
import Link from "next/link";

import { SignUpForm } from '@/features/auth-credentials-form';
import { cn } from '@/shared/lib/utils';
import { AUTH_PAGES } from '@/shared/routes';
import { buttonVariants } from '@/shared/ui/button';
import { SignUpForm } from "../../../features/auth-credentials-form";
import { cn } from "../../../shared/lib/utils";
import { AUTH_PAGES } from "../../../shared/routes";
import { buttonVariants } from "@/shared/ui/button";

export default function SignUPPage() {
return (
Expand All @@ -12,8 +12,8 @@ export default function SignUPPage() {
<Link
href={AUTH_PAGES.SIGN_IN}
className={cn(
buttonVariants({ variant: 'ghost' }),
'absolute right-4 top-4 md:right-8 md:top-8',
buttonVariants({ variant: "ghost" }),
"absolute right-4 top-4 md:right-8 md:top-8",
)}
>
Войти
Expand Down
4 changes: 4 additions & 0 deletions src/app/dashboard/account/page.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import { Metadata } from "next";
import { redirect } from "next/navigation";

import { Button } from "@/shared/ui/button";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/shared/ui/card";
import { Input } from "@/shared/ui/input";
import { DASHBOARD_PAGES } from "@/shared/routes";

export const metadata: Metadata = {
title: "Настройки",
};

export default async function SettingsPage() {
redirect(DASHBOARD_PAGES.PROFILES);

return (
<div className="flex flex-col items-start py-4">
<h1 className="text-xl font-bold mb-8">Управление аккаунтом</h1>
Expand Down
113 changes: 9 additions & 104 deletions src/app/dashboard/integrations/page.tsx
Original file line number Diff line number Diff line change
@@ -1,106 +1,11 @@
"use client";
import type { Metadata } from "next";

import { useState } from "react";
import { IntegrationsPage } from "@/views/integrations";

import { GenerateLauncherDialog } from "@/widgets/generate-launcher-dialog";
import { ChooseAuthenticationMethodDialog } from "@/widgets/choose-authentication-method-dialog";
import { ConnectSentryDialog } from "@/widgets/connect-sentry-dialog";
import { ConnectTexturesDialog } from "@/widgets/connect-textures-dialog";

import { IntegrationCard } from "@/entities/IntegrationCard";

import { Breadcrumbs } from "@/shared/ui/Breadcrumbs";
import { useSentry } from "@/shared/hooks";
import { DASHBOARD_PAGES } from "@/shared/routes";

export default function IntegrationsPage() {
const [isGenerateLauncherDialogOpen, setIsGenerateLauncherDialogOpen] = useState(false);
const onGenerateLauncherDialogToggle = () => setIsGenerateLauncherDialogOpen((prev) => !prev);

const [isAuthenticationDialogOpen, setIsAuthenticationDialogOpen] = useState(false);
const onAuthenticationDialogToggle = () => setIsAuthenticationDialogOpen((prev) => !prev);

const [isSentryConnectDialogOpen, setIsSentryConnectDialogOpen] = useState(false);
const onSentryConnectDialogToggle = () => setIsSentryConnectDialogOpen((prev) => !prev);

const [isConnectTexturesDialogOpen, setIsConnectTexturesDialogOpen] = useState(false);
const onConnectTexturesDialogToggle = () => setIsConnectTexturesDialogOpen((prev) => !prev);

const { data: sentry, isLoading: isLoadingSentry } = useSentry();

return (
<>
<Breadcrumbs
current={"Интеграции"}
breadcrumbs={[{ value: "Главная", path: DASHBOARD_PAGES.HOME }]}
/>
<div className="flex flex-col items-start py-4">
<div className="flex justify-between w-full">
<h1 className="text-xl font-bold mb-8">Интеграции</h1>
</div>
<div className="grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-4">
<IntegrationCard
title="Аутентификация"
description="Синхронизация и управление данными о пользователях на платформе"
action={onAuthenticationDialogToggle}
status={"CONNECTED"}
buttonText={"Изменить"}
/>
<IntegrationCard
title="Сборка лаунчера"
description="Создайте лаунчер для платформ Windows, MacOS и Linux в пару кликов"
action={onGenerateLauncherDialogToggle}
status={"CONNECTED"}
buttonText={"Собрать"}
/>
<IntegrationCard
title="Сервис скинов"
description="Добавь интеграцию со сервисом скинов, для отображения скинов и плащей в игре"
action={onConnectTexturesDialogToggle}
status={"CONNECTED"}
buttonText={"Настроить"}
/>
<IntegrationCard
title="Sentry"
description={"Подключение платформы для отслеживания ошибок и мониторинга приложений"}
action={onSentryConnectDialogToggle}
isDisabled={isLoadingSentry}
status={sentry?.url ? "CONNECTED" : "UNCONNECTED"}
buttonText={sentry?.url ? "Изменить" : "Подключить"}
/>
<IntegrationCard
isDisabled
title="Discord"
description="Синхронизация лаунчера и вашего Discord сервера"
/>
<IntegrationCard
isDisabled
buttonText="Предложить"
title="Нужен сервис?"
description="Отправь заявку, а мы придумаем что-нибудь"
/>
</div>
</div>

<ChooseAuthenticationMethodDialog
open={isAuthenticationDialogOpen}
onOpenChange={onAuthenticationDialogToggle}
/>

<GenerateLauncherDialog
open={isGenerateLauncherDialogOpen}
onOpenChange={onGenerateLauncherDialogToggle}
/>

<ConnectSentryDialog
open={isSentryConnectDialogOpen}
onOpenChange={onSentryConnectDialogToggle}
/>

<ConnectTexturesDialog
open={isConnectTexturesDialogOpen}
onOpenChange={onConnectTexturesDialogToggle}
/>
</>
);
}
export const metadata: Metadata = {
title: "Интеграции",
};
const Page = async () => {
return <IntegrationsPage />;
};
export default Page;
5 changes: 5 additions & 0 deletions src/app/dashboard/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import { Metadata } from "next";
import { redirect } from "next/navigation";

import { Breadcrumbs } from "@/shared/ui/Breadcrumbs";
import { DASHBOARD_PAGES } from "@/shared/routes";

export const metadata: Metadata = {
title: "Дашборд",
};

export default async function DashboardPage() {
redirect(DASHBOARD_PAGES.PROFILES);

return (
<>
<Breadcrumbs current={"Главная"} />
Expand Down
90 changes: 12 additions & 78 deletions src/app/dashboard/profile/[name]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,82 +1,16 @@
"use client";
import type { Metadata } from "next";

import { useEffect } from "react";
import { ProfilePage } from "@/views/profile";

import Image from "next/image";

import { DownloadClientHub } from "@/widgets/client-hub";

import { Section } from "@/entities/Section";

import { EditProfileForm } from "@/features/edit-profile-form/ui/EditProfileForm";

import { DASHBOARD_PAGES } from "@/shared/routes";
import { OsArchitectureEnum, OsTypeEnum } from "@/shared/enums";
import { useProfile } from "@/shared/hooks";
import { Breadcrumbs } from "@/shared/ui/Breadcrumbs";
import { getStorageAccessToken, getStorageProfile } from "@/shared/services/AuthTokenService";

import { default as ProfileLoading } from "./loading";

export default function ProfilePage() {
const account = getStorageProfile();
const accessToken = getStorageAccessToken();
const { data, mutate, isPending } = useProfile();
const profile = data?.data;

useEffect(() => {
if (account && accessToken && profile) {
mutate({
UserName: account.login,
ProfileName: profile.profileName,
UserAccessToken: accessToken,
UserUuid: "uuid",
OsArchitecture: OsArchitectureEnum.X64,
OsType: OsTypeEnum.WINDOWS.toString(),
});
}
}, []);

if (isPending || !profile) return <ProfileLoading />;

return (
<>
<Breadcrumbs
current={profile.profileName}
breadcrumbs={[
{ value: "Главная", path: DASHBOARD_PAGES.HOME },
{
value: "Профили",
path: DASHBOARD_PAGES.PROFILES,
},
]}
/>
<div className="flex gap-x-8 items-center">
<div className={"flex justify-center items-center h-24 w-24 bg-gray-50 rounded-lg"}>
<Image
className="min-w-12 min-h-12"
src={`data:text/plain;base64,${profile.iconBase64}`}
alt={profile.profileName}
width={32}
height={32}
/>
</div>
<div className="flex flex-col gap-y-2">
<h2 className="text-4xl font-bold">Профиль {profile.profileName}</h2>
<p className="text-sm text-gray-700 dark:text-gray-300">{profile.clientVersion}</p>
</div>
</div>
export async function generateMetadata({ params: { name } }: Props): Promise<Metadata> {
return { title: `Настройка профиля ${name}` };
}

<Section
title="Настройки профиля"
subtitle="Обновите фотографию профиля и подробную информацию здесь"
>
<EditProfileForm profile={profile} />
</Section>
type Props = {
params: { name: string };
};

<Section title="Загрузка клиента" subtitle="Необходимо для генерации клиента Minecraft">
<DownloadClientHub key="DownloadClientHub" profile={profile} />
</Section>
</>
);
}
const Page = async (props: Props) => {
return <ProfilePage {...props} />;
};
export default Page;
47 changes: 9 additions & 38 deletions src/app/dashboard/profiles/page.tsx
Original file line number Diff line number Diff line change
@@ -1,40 +1,11 @@
"use client";
import type { Metadata } from "next";

import { useState } from "react";
import { ProfilesPage } from "@/views/profiles";

import { CreateProfileDialog } from "@/widgets/create-profile-dialog";
import { ProfilesTable } from "@/widgets/profiles-table";

import { Button } from "@/shared/ui/button";
import { Breadcrumbs } from "@/shared/ui/Breadcrumbs";
import { DASHBOARD_PAGES } from "@/shared/routes";

export default function ProfilesPage() {
const [isCreateProfileDialog, setIsCreateProfileDialog] = useState(false);
const onCreateProfileDialogToggle = () => setIsCreateProfileDialog((prev) => !prev);

return (
<>
<Breadcrumbs
current={"Профили"}
breadcrumbs={[{ value: "Главная", path: DASHBOARD_PAGES.HOME }]}
/>
<div className="flex flex-col items-start py-4">
<div className="flex justify-between w-full">
<h1 className="text-xl font-bold mb-8">Профили</h1>
<Button className="w-fit" onClick={onCreateProfileDialogToggle}>
Создать профиль
</Button>
</div>
<div className="flex flex-col gap-y-6 w-full">
<ProfilesTable />
</div>
</div>

<CreateProfileDialog
open={isCreateProfileDialog}
onOpenChange={onCreateProfileDialogToggle}
/>
</>
);
}
export const metadata: Metadata = {
title: "Профили",
};
const Page = async () => {
return <ProfilesPage />;
};
export default Page;
10 changes: 6 additions & 4 deletions src/app/dashboard/settings/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { Metadata } from "next";
import type { Metadata } from "next";

import { SettingsPage } from "@/screens/settings";
import { SettingsPage } from "@/views/settings";

export const metadata: Metadata = {
title: "Настройки платформы",
};

export default SettingsPage;
const Page = async () => {
return <SettingsPage />;
};
export default Page;
Loading

0 comments on commit 575a45c

Please sign in to comment.