-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhanced Game Server Management and Notification System Updates (#68)
* Feature/game servers (#58) * Add game server management functionality This commit introduces the ability to add and delete game servers. It also includes the UI for managing game servers, validation schemas for server attributes, and relevant hooks for server data fetching and manipulation. A skeleton UI component for when server data is loading has also been included. * Добавлено состояние отключения профиля и обновлён интерфейс серверной карты В перечисление ProfileState добавлено состояние отключённого профиля. В файле ServerCard добавлено отображение состояний онлайн/офлайн и прогресса загрузки. Также обновлён визуальный стиль карточки сервера. * Add profile parameter to server deletion process The GameServerCard and DeleteGameServerDialog components have been updated to now require a profile parameter. The deletion process has been adjusted to now consider this new profile data. This change necessitates some dependency imports updates and refactoring in related files as well. * Рефакторинг * Исправление ошибок UX/DX и рефаторинг запросов (#61) * Исправление ошибок UX * Исправление ошибок DX * Рефаторинг запросов * Рефаторинг запросов --------- Co-authored-by: vaterentev <vaterentev@icloud.com> * Add notifications feature and related UI components (#62) * Add notifications feature Several new files and modifications have been introduced to set up the notifications feature. This includes the creation of notification services, schemas, and requests, as well as modifying the main layout to include notifications. The notifications view and UI were established and a connection hub for notifications was formed. * Update notification hooks and display The `useNotifications` hook was updated for a better handling of notifications data. Notification display was also refined in `NotificationPage` and `Notifications` components to cater to the changes. Additionally, some minor UI adjustments and improvements in labelling were made within various files. * Рефакторинг * Выбор билда клиента (#60) * Rebase * Рефакторинг * Рефакторинг * Рефакторинг * Рефакторинг * Исправление недочётов в уведомлениях * Рефакторинг * Рефакторинг * Орфография и рефакторинг * Рефакторинг * Добавлена поддержка GameLoaderOption.FABRIC в CreateProfileForm (#63) Была расширена логика формы создания профиля для поддержки нового варианта загрузчика игры - GameLoaderOption.FABRIC. Теперь при выборе этого варианта, также активируются соответствующие поля и параметры формы. * Обновлен интерфейс уведомлений (#65) Были добавлены новые компоненты в интерфейс уведомлений и улучшен внешний вид уведомлений. Также увеличено количество отображаемых уведомлений с 3 до 10. Добавлен переход на страницу уведомлений при нажатии на каждое из них. * Fix integration edit texture service (#67) Пофиксил баг с изменением скинов и плащей --------- Co-authored-by: Vadim Terentev <scondic@icloud.com> Co-authored-by: vaterentev <vaterentev@icloud.com> Co-authored-by: Akemiko <67152382+Arsenii1109@users.noreply.github.com>
- Loading branch information
1 parent
6cdd2b3
commit 92e83f9
Showing
76 changed files
with
3,899 additions
and
1,469 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
# misc | ||
.DS_Store | ||
*.pem | ||
.idea | ||
|
||
# debug | ||
npm-debug.log* | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type { Metadata } from "next"; | ||
|
||
import { NotificationPage } from "@/views/notification"; | ||
|
||
export const metadata: Metadata = { | ||
title: "Уведомления", | ||
}; | ||
|
||
const Page = () => { | ||
return <NotificationPage />; | ||
}; | ||
|
||
export default Page; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export const BRAND_NAME = "GML"; | ||
export const PLATFORM_SHORT_APP_NAME = "Frontend"; | ||
export const PLATFORM_APP_NAME = `${BRAND_NAME} ${PLATFORM_SHORT_APP_NAME}`; | ||
|
||
type Config = { | ||
name: string; | ||
}; | ||
|
||
export const config: Config = { | ||
name: PLATFORM_APP_NAME, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./ui/NotificationCard"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { Copy } from "lucide-react"; | ||
import { toast as sonner } from "sonner"; | ||
|
||
import { getFormatDate } from "@/shared/lib/utils"; | ||
import { Card } from "@/shared/ui/card"; | ||
import { Button } from "@/shared/ui/button"; | ||
import { NotificationBaseEntity } from "@/shared/api/contracts"; | ||
|
||
interface ProfileCardParams { | ||
card: NotificationBaseEntity; | ||
} | ||
|
||
export const NotificationCard = ({ card }: ProfileCardParams) => { | ||
return ( | ||
<Card className={"flex flex-col justify-between gap-y-2 p-3"}> | ||
<div className="flex justify-between items-center gap-x-2"> | ||
<span className="text-base font-semibold">{card.message}</span> | ||
<span className="text-sm text-muted-foreground">{getFormatDate(card.date)}</span> | ||
</div> | ||
{card.details && ( | ||
<div className="max-h-20 overflow-hidden"> | ||
<span className="text-sm text-muted-foreground ">{card.details}</span> | ||
</div> | ||
)} | ||
<Button | ||
variant="secondary" | ||
className="w-fit" | ||
onClick={async () => { | ||
await navigator.clipboard.writeText(card.details ? card.details : card.message); | ||
sonner("Текст успешно скопирован", { | ||
duration: 1500, | ||
onAutoClose: () => true, | ||
}); | ||
}} | ||
> | ||
<Copy className="h-3 w-3 mr-1" /> | ||
Копировать | ||
</Button> | ||
</Card> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./ui/GameServerCard"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import React from "react"; | ||
|
||
import Image from "next/image"; | ||
|
||
import { ClientState } from "@/widgets/client-hub"; | ||
|
||
import { DeleteGameServerDialog } from "@/features/delete-game-server"; | ||
|
||
import { GameServerBaseEntity } from "@/shared/api/contracts"; | ||
import { Card } from "@/shared/ui/card"; | ||
import { Progress } from "@/shared/ui/progress"; | ||
import { getProgressColor } from "@/shared/lib/utils"; | ||
import { EntityState } from "@/shared/enums"; | ||
|
||
import minecraftLogo from "@/assets/logos/minecraft.png"; | ||
|
||
interface GameServerCardParams { | ||
profileName: string; | ||
server: GameServerBaseEntity; | ||
} | ||
|
||
export const GameServerCard = ({ server, profileName }: GameServerCardParams) => { | ||
const progressValue = (server.online * 100) / server.maxOnline; | ||
|
||
return ( | ||
<Card className="flex flex-row items-center justify-between gap-y-4 p-3 pr-8"> | ||
<div className="flex flex-row gap-x-5 items-center"> | ||
<Image src={minecraftLogo} className="w-16" alt="GML Frontend" /> | ||
<div className="flex flex-col min-w-[350px]"> | ||
<span className="text-lg font-bold">{server.name}</span> | ||
<span className="text-gray-600 dark:text-gray-400 font-medium text-sm"> | ||
{server.version ?? "Нет информации"} | ||
</span> | ||
</div> | ||
{server.isOnline && ( | ||
<div> | ||
<div className="flex flex-row items-center justify-between gap-x-3 ml-3 relative"> | ||
<Progress | ||
value={progressValue} | ||
className={`absolute w-full h-1 bottom-0 rounded ${getProgressColor(progressValue)}`} | ||
/> | ||
<div className="flex flex-row items-center justify-between gap-x-3 relative z-2 mb-3"> | ||
<div className="flex items-center justify-center text-sm font-medium text-muted-foreground rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground transition h-10 w-10"> | ||
{server.online} | ||
</div> | ||
из | ||
<div className="flex items-center justify-center text-sm font-medium text-muted-foreground rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground transition h-10 w-10"> | ||
{server.maxOnline} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
)} | ||
</div> | ||
<div className="flex items-center gap-x-8"> | ||
{server.isOnline ? ( | ||
<ClientState state={EntityState.ENTITY_STATE_ACTIVE} /> | ||
) : ( | ||
<ClientState state={EntityState.ENTITY_STATE_DISABLED} /> | ||
)} | ||
<DeleteGameServerDialog serverName={server.name} profileName={profileName} /> | ||
</div> | ||
</Card> | ||
); | ||
}; |
Empty file.
Oops, something went wrong.