Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to v0.1.0-beta4 #77

Merged
merged 17 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
dceb1e5
Feature/game servers (#58)
Scondic Jul 7, 2024
bb0385b
Исправление ошибок UX/DX и рефаторинг запросов (#61)
Scondic Jul 11, 2024
f577d8e
Add notifications feature and related UI components (#62)
Scondic Jul 11, 2024
980b871
Выбор билда клиента (#60)
Scondic Jul 12, 2024
6343c89
Добавлена поддержка GameLoaderOption.FABRIC в CreateProfileForm (#63)
GamerVII-NET Jul 13, 2024
0d8e877
Обновлен интерфейс уведомлений (#65)
GamerVII-NET Jul 13, 2024
0ea0c90
Fix integration edit texture service (#67)
Arsenii1109 Jul 13, 2024
1fde7a9
Исправление запросов для обновлений текстур (#69)
Arsenii1109 Jul 13, 2024
5b311b2
Feature/create profile (#70)
Arsenii1109 Jul 14, 2024
01158e6
Добавлено управление версиями Java при сборке (#71)
Arsenii1109 Jul 17, 2024
3ac594c
Добавлена проверка подключения к серверу (#72)
Arsenii1109 Jul 17, 2024
a3a4ded
Restructure Integrations page layout (#74)
Arsenii1109 Aug 8, 2024
e23523c
Add support for game arguments in profile form (#73)
Arsenii1109 Aug 8, 2024
91c0caa
Добавлен Zustand для управления состоянием профиля (#75)
Arsenii1109 Aug 9, 2024
f965189
Remove scheduled trigger from Docker workflow
GamerVII-NET Aug 11, 2024
b6e1cc6
Fix/notifications (#76)
Arsenii1109 Aug 11, 2024
7e563ac
Merge branch 'refs/heads/master' into develop
Aug 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/docker-package-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ name: Docker
# documentation.

on:
schedule:
- cron: '37 19 * * *'
push:
branches: [ "master" ]
# Publish semver tags as releases.
Expand Down
40 changes: 39 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"postcss": "^8",
"prettier": "3.3.2",
"tailwindcss": "^3.4.4",
"typescript": "^5.5.3"
"typescript": "^5.5.3",
"zustand": "^4.5.4"
}
}
12 changes: 12 additions & 0 deletions src/entities/ProfileCard/lib/store.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { create } from "zustand";
import { EntityState, EntityStateOption } from "@/shared/enums";

interface State {
state: Nullable<EntityState>;
setState: (state: EntityState) => void;
}

export const useProfileCardStore = create<State>((set) => ({
state: null,
setState: (state) => set(() => ({ state })),
}));
5 changes: 4 additions & 1 deletion src/entities/ProfileCard/ui/ProfileCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
import defaultProfileIcon from "@/assets/logos/minecraft.png";

import classes from "./styles.module.css";
import { useProfileCardStore } from "@/entities/ProfileCard/lib/store";

interface ProfileCardParams {
profile: ProfileExtendedBaseEntity;
Expand Down Expand Up @@ -68,6 +69,8 @@ export const ProfileCard = ({ profile }: ProfileCardParams) => {
window.location.reload();
};

const { state } = useProfileCardStore();

return (
<div
className={classes["profile-card"]}
Expand Down Expand Up @@ -129,7 +132,7 @@ export const ProfileCard = ({ profile }: ProfileCardParams) => {
{/* Профиль */}
<div className={classes["profile-card__info"]}>
<div className={classes["profile-card__info-state"]}>
<ClientState state={profile.state} />
<ClientState state={state || profile.state} />
</div>
<div className={classes["profile-card__info-icon-wrapper"]}>
<Image
Expand Down
20 changes: 12 additions & 8 deletions src/features/connect-textures-form/ui/ConnectTexturesForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,19 @@ export function ConnectTexturesForm({
});

const onSubmit = async (data: ConnectTexturesFormSchemaType) => {
await mutateAsync({
type: TexturesServiceType.TEXTURES_SERVICE_SKINS,
url: data.url_skins,
});
if (form.getFieldState("url_skins").isDirty) {
await mutateAsync({
type: TexturesServiceType.TEXTURES_SERVICE_SKINS,
url: data.url_skins,
});
}

await mutateAsync({
type: TexturesServiceType.TEXTURES_SERVICE_CLOAKS,
url: data.url_cloaks,
});
if (form.getFieldState("url_cloaks").isDirty) {
await mutateAsync({
type: TexturesServiceType.TEXTURES_SERVICE_CLOAKS,
url: data.url_cloaks,
});
}

onOpenChange(false);
};
Expand Down
60 changes: 22 additions & 38 deletions src/features/create-profile-form/ui/CreateProfileForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { Icons } from "@/shared/ui/icons";
import { Input } from "@/shared/ui/input";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/shared/ui/select";
import { Textarea } from "@/shared/ui/textarea";
import { FormCombobox } from "@/shared/ui/FormCombobox";

import loaderMinecraft from "@/assets/logos/minecraft.png";
import loaderForge from "@/assets/logos/forge.png";
Expand Down Expand Up @@ -130,7 +131,6 @@ export function CreateProfileForm(props: CreateProfileFormProps) {
<FormMessage>{form.formState.errors.name.message}</FormMessage>
)}
</FormItem>

<FormItem>
<FormLabel>Введите описание сервера</FormLabel>
<FormControl>
Expand All @@ -146,20 +146,15 @@ export function CreateProfileForm(props: CreateProfileFormProps) {
render={({ field }) => (
<FormItem className="flex-1">
<FormLabel>Выберите версию игры</FormLabel>
<FormControl>
<Select onValueChange={field.onChange} defaultValue={field.value}>
<SelectTrigger>
<SelectValue placeholder="Выберите версию игры" />
</SelectTrigger>
<SelectContent>
{versions.data?.map((version: string) => (
<SelectItem key={version} value={version}>
{version}
</SelectItem>
))}
</SelectContent>
</Select>
</FormControl>
<FormCombobox
name={field.name}
value={field.value}
placeholder="Выберите версию игры"
placeholderInputSearch="Поиск версий"
options={versions && versions.data}
isLoading={versions.isLoading}
setValue={form.setValue}
/>
{form.formState.errors.version && (
<FormMessage>{form.formState.errors.version.message}</FormMessage>
)}
Expand Down Expand Up @@ -207,28 +202,17 @@ export function CreateProfileForm(props: CreateProfileFormProps) {
render={({ field }) => (
<FormItem className="flex-1">
<FormLabel>Выберите версию загрузчика</FormLabel>
<FormControl>
<Select
onValueChange={field.onChange}
value={field.value}
disabled={
!form.getFieldState("version").isDirty ||
loaderVersion.isFetching ||
loaderVersion.isError
}
>
<SelectTrigger>
<SelectValue placeholder="Выберите версию загрузчика" />
</SelectTrigger>
<SelectContent>
{loaderVersion.data?.map((loader: string) => (
<SelectItem key={loader} value={loader}>
{loader}
</SelectItem>
))}
</SelectContent>
</Select>
</FormControl>
<FormCombobox
name={field.name}
value={field.value}
placeholder="Выберите версию загрузчика"
placeholderInputSearch="Поиск версии загрузчика"
options={loaderVersion && loaderVersion.data}
description="Данная версия игры не поддерживается загрузчиком"
isError={loaderVersion.isError}
isLoading={!form.getFieldState("version").isDirty || loaderVersion.isFetching}
setValue={form.setValue}
/>
{form.formState.errors.gameLoader && (
<FormMessage>{form.formState.errors.gameLoader.message}</FormMessage>
)}
Expand All @@ -238,7 +222,7 @@ export function CreateProfileForm(props: CreateProfileFormProps) {
)}

<div className="flex justify-end">
<Button disabled={isPending || !form.formState.isDirty}>
<Button disabled={isPending || !form.formState.isDirty || loaderVersion.isError}>
{isPending && <Icons.spinner className="mr-2 h-4 w-4 animate-spin" />}
Создать
</Button>
Expand Down
25 changes: 24 additions & 1 deletion src/features/edit-profile-form/ui/EditProfileForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const EditProfileForm = (props: EditProfileFormProps) => {
name: profile?.profileName || "",
description: profile?.description || "",
jvmArguments: profile?.jvmArguments || "",
gameArguments: profile?.gameArguments || "",
icon: profile?.iconBase64 || "",
background: profile?.background || "",
},
Expand All @@ -56,6 +57,10 @@ export const EditProfileForm = (props: EditProfileFormProps) => {
formUpdate.append("jvmArguments", body.jvmArguments);
}

if (body.gameArguments) {
formUpdate.append("gameArguments", body.gameArguments);
}

await mutateAsync(formUpdate);

if (form.formState.dirtyFields.name) {
Expand Down Expand Up @@ -98,7 +103,9 @@ export const EditProfileForm = (props: EditProfileFormProps) => {
<div className="grid grid-cols-1 lg:grid-cols-2 gap-x-8">
<div className="flex flex-col gap-y-1 min-w-96 mb-2 lg:mb-0">
<h6 className="text-sm font-bold">Jvm Аргументы</h6>
<p className="text-sm text-gray-700 dark:text-gray-300">Параметры запуска клиента</p>
<p className="text-sm text-gray-700 dark:text-gray-300">
Параметры запуска виртуальной Java машины
</p>
</div>
<div className="flex flex-col gap-y-1 min-w-96 mb-2 lg:mb-0">
<Input
Expand All @@ -111,6 +118,22 @@ export const EditProfileForm = (props: EditProfileFormProps) => {
)}
</div>
</div>
<div className="grid grid-cols-1 lg:grid-cols-2 gap-x-8">
<div className="flex flex-col gap-y-1 min-w-96 mb-2 lg:mb-0">
<h6 className="text-sm font-bold">Game Аргументы</h6>
<p className="text-sm text-gray-700 dark:text-gray-300">Параметры запуска клиента</p>
</div>
<div className="flex flex-col gap-y-1 min-w-96 mb-2 lg:mb-0">
<Input
type="text"
placeholder="Введите ваши game аргументы"
{...form.register("gameArguments")}
/>
{form.formState.errors.gameArguments && (
<FormMessage>{form.formState.errors.gameArguments.message?.toString()}</FormMessage>
)}
</div>
</div>
<div className="flex justify-end">
<Button disabled={isPending || form.formState.disabled || !form.formState.isDirty}>
{isPending && <Icons.spinner className="mr-2 h-4 w-4 animate-spin" />}
Expand Down
Loading
Loading