Skip to content

Commit

Permalink
GL-37: восстановление билда проекта
Browse files Browse the repository at this point in the history
  • Loading branch information
Терентьев Вадим Алексеевич committed May 9, 2024
1 parent 6e1fe95 commit a8ecb4d
Show file tree
Hide file tree
Showing 6 changed files with 274 additions and 28 deletions.
109 changes: 103 additions & 6 deletions src/app/dashboard/integrations/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,106 @@
import { Metadata } from "next";
"use client";

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

export const metadata: Metadata = {
title: "Интеграции",
};
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";

export default IntegrationsPage;
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}
/>
</>
);
}
2 changes: 1 addition & 1 deletion src/app/dashboard/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Metadata } from "next";
import { Breadcrumbs } from "@/shared/ui/Breadcrumbs/ui/Breadcrumbs";
import { Breadcrumbs } from "@/shared/ui/Breadcrumbs";

export const metadata: Metadata = {
title: "Дашборд",
Expand Down
54 changes: 52 additions & 2 deletions src/app/dashboard/profile/[name]/loading.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,53 @@
import { ProfileLoading } from "@/screens/profile/ui/ProfileLoading";
"use client";

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

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

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

export default function ProfileLoading() {
return (
<>
<Breadcrumbs
current={"..."}
breadcrumbs={[
{ value: "Главная", path: DASHBOARD_PAGES.HOME },
{
value: "Профили",
path: DASHBOARD_PAGES.PROFILES,
},
]}
/>
<div className="flex gap-x-8 items-center">
<Skeleton className="h-24 w-24" />
<div className="flex flex-col gap-y-2">
<Skeleton className="h-10 w-96" />
<Skeleton className="h-5 w-48" />
</div>
</div>
<section className="flex flex-col gap-y-4 mb-8">
<div className="flex flex-col gap-y-1">
<h5 className="text-xl font-bold">Настройки профиля</h5>
<p className="text-sm text-gray-700 dark:text-gray-300">
Обновите фотографию профиля и подробную информацию здесь
</p>
</div>
<hr />
<EditProfileForm isLoading />
</section>
<section className="flex flex-col gap-y-4 mb-8">
<div className="flex flex-col gap-y-1">
<h5 className="text-xl font-bold">Загрузка клиента</h5>
<p className="text-sm text-gray-700 dark:text-gray-300">
Необходимо для генерации клиента Minecraft
</p>
</div>
<hr />
<DownloadClientHub key="DownloadClientHub" isLoading />
</section>
</>
);
}
89 changes: 78 additions & 11 deletions src/app/dashboard/profile/[name]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,82 @@
import type { Metadata } from "next";
"use client";

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

type PageProps = {
params: { name: string };
};
import Image from "next/image";

export async function generateMetadata({ params }: PageProps): Promise<Metadata> {
return {
title: `Редактирование профиля — ${params.name}`,
};
}
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;

export default ProfilePage;
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>

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

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

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

export const metadata: Metadata = {
title: "Профили",
};
import { CreateProfileDialog } from "@/widgets/create-profile-dialog";
import { ProfilesTable } from "@/widgets/profiles-table";

export default ProfilesPage;
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}
/>
</>
);
}
5 changes: 3 additions & 2 deletions src/screens/settings/ui/Settings.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"use client";

import { Breadcrumbs } from "@/shared/ui/Breadcrumbs/ui/Breadcrumbs";
import { DASHBOARD_PAGES } from "@/shared/routes";
import { EditSettingsPlatformForm } from "@/features/edit-settings-platform-form";

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

export const SettingsPage = () => {
return (
<>
Expand Down

0 comments on commit a8ecb4d

Please sign in to comment.