Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 2 additions & 3 deletions apps/oneclient/frontend/src/components/SkinViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
enableZoom = true,
enableRotate = true,
enablePan = true,
elytra = false
elytra = false,
}: SkinViewerProps) {
const canvasRef = useRef<HTMLCanvasElement>(null);
const viewerRef = useRef<skinviewer.SkinViewer | null>(null);
Expand Down Expand Up @@ -78,13 +78,12 @@
viewer.controls.object.position.set(x, y, z);
viewer.controls.object.lookAt(viewer.controls.target);
};
setAngle(playerRotatePhi, playerRotateTheta)
setAngle(playerRotatePhi, playerRotateTheta);

viewer.playerWrapper.translateX(translateRotateX);
viewer.playerWrapper.translateY(translateRotateY);
viewer.playerWrapper.translateZ(translateRotateZ);


viewer.animation = animation;

viewer.autoRotate = autoRotate;
Expand All @@ -95,7 +94,7 @@
return () => {
viewer.dispose();
};
}, []);

Check warning on line 97 in apps/oneclient/frontend/src/components/SkinViewer.tsx

View workflow job for this annotation

GitHub Actions / ES Checks

React Hook useEffect has missing dependencies: 'animation', 'autoRotate', 'autoRotateSpeed', 'enableDamping', 'enablePan', 'enableRotate', 'enableZoom', 'playerRotatePhi', 'playerRotateTheta', 'translateRotateX', 'translateRotateY', 'translateRotateZ', and 'zoom'. Either include them or remove the dependency array

useEffect(() => {
if (!viewerRef.current)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ export function RemoveAccountModal({
<Overlay.Dialog>
<Overlay.Title>Are you sure?</Overlay.Title>

<p>Do you want to remove <span className='font-bold' color='primary'>{profile.username}</span> from you're accounts?</p>
<p>
Do you want to remove
<span className="font-bold" color="primary">{profile.username}</span>
{' '}
from you're accounts?
</p>
<p>This cannot be undone</p>

<AccountRow profile={profile} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Button } from '@onelauncher/common/components';
import { Overlay } from './Overlay';

export function RemoveSkinCapeModal({ onPress }: { onPress: () => void; }) {
export function RemoveSkinCapeModal({ onPress }: { onPress: () => void }) {
return (
<Overlay.Dialog>
<Overlay.Title>Are you sure?</Overlay.Title>
Expand Down
42 changes: 22 additions & 20 deletions apps/oneclient/frontend/src/routes/app/accountSkin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { usePlayerProfile } from '@/hooks/usePlayerProfile';
import { bindings } from '@/main';
import { getSkinUrl } from '@/utils/minecraft';
import { toast } from '@/utils/toast';
import { useCommandSuspense } from '@onelauncher/common';
import { Button } from '@onelauncher/common/components';
import { useQueryClient } from '@tanstack/react-query';
Expand All @@ -17,7 +18,6 @@
import { useEffect, useState } from 'react';
import { DialogTrigger } from 'react-aria-components';
import { CrouchAnimation, FlyingAnimation, HitAnimation, IdleAnimation, WalkingAnimation } from 'skinview3d';
import { toast } from '@/utils/toast';

interface Skin {
is_slim: boolean;
Expand Down Expand Up @@ -113,8 +113,8 @@

fetchSkins();

setCapes([{ url: "", id: "" }, ...loggedInUser.capes.map(cape => ({ url: cape.url, id: cape.id }))]);
setCapes([{ url: '', id: '' }, ...loggedInUser.capes.map(cape => ({ url: cape.url, id: cape.id }))]);
}, [loggedInUser]);

Check warning on line 117 in apps/oneclient/frontend/src/routes/app/accountSkin.tsx

View workflow job for this annotation

GitHub Actions / ES Checks

React Hook useEffect has a missing dependency: 'setSkins'. Either include it or remove the dependency array
const { data: profile } = usePlayerProfile(currentAccount?.id);
const [animation, setAnimation] = useState<PlayerAnimation>(animations[0].animation);
const [animationName, setAnimationName] = useState<string>(animations[0].name);
Expand All @@ -131,7 +131,7 @@
return [skinData, ...filtered];
});
setSelectedSkin(skinData);
}, [skinData.skin_url, profile]);

Check warning on line 134 in apps/oneclient/frontend/src/routes/app/accountSkin.tsx

View workflow job for this annotation

GitHub Actions / ES Checks

React Hook useEffect has missing dependencies: 'setSkins' and 'skinData'. Either include them or remove the dependency array

const [selectedCape, setSelectedCape] = useState<string>('');

Expand All @@ -145,22 +145,22 @@
title: 'Import Skin',
message: `Importing skin from ${username}`,
});
const { id } = await bindings.core.convertUsernameUUID(username) ?? { id: '', username: '' }
const { id } = await bindings.core.convertUsernameUUID(username);
if (id === '')
return toast({
type: 'error',
title: 'Import Skin',
message: `${username} doesn't exist`,
});
const playerProfile = await bindings.core.fetchMinecraftProfile(id)
const playerProfile = await bindings.core.fetchMinecraftProfile(id);
if (playerProfile.skin_url)
setSkins([...skins, { is_slim: playerProfile.is_slim, skin_url: playerProfile.skin_url }]);
toast({
type: 'success',
title: 'Import Skin',
message: `Imported skin from ${username}`,
});
}
};

const [shouldShowElytra, setShouldShowElytra] = useState<boolean>(false);

Expand All @@ -170,11 +170,13 @@
return;
await bindings.core.changeSkin(currentAccount.access_token, selectedSkin.skin_url, selectedSkin.is_slim ? 'slim' : 'classic');
if (selectedCape === '') {
await bindings.core.removeCape(currentAccount.access_token)
} else {
const capeData = capes.find((cape) => cape.url === selectedCape)
if (!capeData) return
await bindings.core.changeCape(currentAccount.access_token, capeData.id)
await bindings.core.removeCape(currentAccount.access_token);
}
else {
const capeData = capes.find(cape => cape.url === selectedCape);
if (!capeData)
return;
await bindings.core.changeCape(currentAccount.access_token, capeData.id);
}
queryClient.invalidateQueries({
queryKey: ['getDefaultUser'],
Expand Down Expand Up @@ -363,16 +365,16 @@
{selected.skin_url === skin.skin_url
? <></>
: (
<DialogTrigger>
<Button className="group w-8 h-8 absolute top-0 right-0" color="ghost" size="icon">
<Trash01Icon className="group-hover:stroke-danger" />
</Button>

<Overlay>
<RemoveSkinCapeModal onPress={() => setSkins(prev => prev.filter(skinData => skinData.skin_url !== skin.skin_url))} />
</Overlay>
</DialogTrigger>
)}
<DialogTrigger>
<Button className="group w-8 h-8 absolute top-0 right-0" color="ghost" size="icon">
<Trash01Icon className="group-hover:stroke-danger" />
</Button>

<Overlay>
<RemoveSkinCapeModal onPress={() => setSkins(prev => prev.filter(skinData => skinData.skin_url !== skin.skin_url))} />
</Overlay>
</DialogTrigger>
)}
<Button
className="group w-8 h-8 absolute bottom-0 right-0"
color="ghost"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Sidebar from './route';

export const Route = createFileRoute('/app/settings/developer')({
component: RouteComponent,
})
});

function RouteComponent() {
return (
Expand Down
50 changes: 26 additions & 24 deletions apps/oneclient/frontend/src/routes/onboarding/account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,30 +70,32 @@ function RouteComponent() {
<h1 className="text-4xl font-semibold mb-2">Account</h1>
<p className="text-slate-400 text-lg mb-2">Before you continue, we require you to own a copy of Minecraft: Java Edition.</p>
</div>
{currentAccount ?
<>
<AccountPreview profile={currentAccount} />
</>
:
<>
{profile
? (
<>
<AccountPreview profile={profile} />
</>
)
: (
<Button
color="primary"
isPending={isPending}
onClick={onClick}
size="large"
>
Add Account
</Button>
)}
</>
}
{currentAccount
? (
<>
<AccountPreview profile={currentAccount} />
</>
)
: (
<>
{profile
? (
<>
<AccountPreview profile={profile} />
</>
)
: (
<Button
color="primary"
isPending={isPending}
onClick={onClick}
size="large"
>
Add Account
</Button>
)}
</>
)}
</div>
);
}
9 changes: 4 additions & 5 deletions apps/oneclient/frontend/src/routes/onboarding/language.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ const languageList: Array<Language> = [
},
];


function RouteComponent() {
return (
<div className='flex flex-row h-full p-24 pt-48 gap-8'>
<div className='h-full w-1/3'>
<img src={Illustration} alt="Language selection illustration" />
<div className="flex flex-row h-full p-24 pt-48 gap-8">
<div className="h-full w-1/3">
<img alt="Language selection illustration" src={Illustration} />
</div>

<div className='flex flex-col w-2/3'>
<div className="flex flex-col w-2/3">
<h1 className="text-4xl font-semibold mb-2">Language</h1>
<p className="text-slate-400 text-lg mb-2">Choose your preferred language.</p>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { createFileRoute } from '@tanstack/react-router'
import { createFileRoute } from '@tanstack/react-router';

export const Route = createFileRoute('/onboarding/preferences/')({
component: RouteComponent,
})
component: RouteComponent,
});

function RouteComponent() {
return <div>Hello "/onboarding/preferences/"!</div>
return <div>Hello "/onboarding/preferences/"!</div>;
}
4 changes: 2 additions & 2 deletions apps/oneclient/frontend/src/routes/onboarding/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ export function OnboardingNavigation() {
)}
</div>
<div>
<Link disabled={forceLoginDisable} to={nextPath ?? "/app"}>
<Button className={`w-32 ${forceLoginDisable ? "line-through" : ""}`} color={forceLoginDisable ? 'secondary' : 'primary'}>Next</Button>
<Link disabled={forceLoginDisable} to={nextPath ?? '/app'}>
<Button className={`w-32 ${forceLoginDisable ? 'line-through' : ''}`} color={forceLoginDisable ? 'secondary' : 'primary'}>Next</Button>
</Link>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions apps/onelauncher/frontend/src/routes/app/cluster/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function RouteComponent() {
enabled: !!cluster.data?.setting_profile_name,
});

const save = useCommand('updateClusterProfile', () => bindings.core.updateClusterProfile(cluster.data?.name as string, _result.data!), {
const save = useCommand('updateClusterProfile', () => bindings.core.updateClusterProfile(cluster.data?.name as string, _result.data), {
enabled: false,
subscribed: false,
});
Expand All @@ -36,9 +36,9 @@ function RouteComponent() {
<div className="h-full">
<h1>Minecraft Settings</h1>

<GameSettings key={_result.data?.name} settings={_result.data!} />
<GameSettings key={_result.data?.name} settings={_result.data} />

<ProcessSettings key={_result.data?.name} settings={_result.data!} />
<ProcessSettings key={_result.data?.name} settings={_result.data} />
</div>
</ScrollableContainer>
</Sidebar.Page>
Expand Down
4 changes: 3 additions & 1 deletion apps/onelauncher/frontend/src/routes/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ function ClusterCard({
</div>

{/* <LaunchButton cluster={props} iconOnly /> */}
<Button onClick={handleLaunch} size="icon"><PlayIcon /></Button>
<Button onClick={handleLaunch} size="icon">
<PlayIcon />
</Button>
</div>
</div>
</Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const Route = createFileRoute('/app/settings/minecraft')({
function RouteComponent() {
const result = useCommand('readSettings', bindings.core.readSettings);

const save = useCommand('writeSettings', () => bindings.core.writeSettings(result.data!), {
const save = useCommand('writeSettings', () => bindings.core.writeSettings(result.data), {
enabled: false,
subscribed: false,
});
Expand All @@ -31,11 +31,11 @@ function RouteComponent() {
<div className="h-full">
<h1>Minecraft Settings</h1>

<GameSettings settings={result.data!.global_game_settings} />
<GameSettings settings={result.data.global_game_settings} />

{/* <LauncherSettings /> */}

<ProcessSettings settings={result.data!.global_game_settings} />
<ProcessSettings settings={result.data.global_game_settings} />
</div>
</ScrollableContainer>
</Sidebar.Page>
Expand Down
19 changes: 12 additions & 7 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,21 @@ import { defineConfig } from '@flowr/eslint';
// @ts-ignore -- No types for this package
import { tanstackConfig } from '@tanstack/eslint-config';

const ignores = [
'*.rs',
'**/migrations/**',
'apps/onelauncher/old_frontend',
'apps/*/desktop/capabilities',
'apps/*/desktop/gen',
'**/*.gen.*',
];

export default defineConfig(
{
typescript: true,
react: true,
query: true,
ignores: ['*.rs', '**/migrations/**'],
ignores,
toml: {
overrides: {
'toml/array-element-newline': ['error', 'always'],
Expand All @@ -24,12 +33,7 @@ export default defineConfig(
return config;
}),
{
ignores: [
'apps/onelauncher/old_frontend',
'apps/*/desktop/capabilities',
'apps/*/desktop/gen',
'**/*.gen.*',
],
ignores,
// overrides: [
// {
// files: ['vite.config.js'],
Expand All @@ -40,6 +44,7 @@ export default defineConfig(
// ],
},
{
ignores,
rules: {
'sort-imports': 'off', // Replaced by perfectionist/sort-named-imports',
'import/order': 'off', // Replaced by perfectionist/sort-named-imports',
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@
"web_common": "pnpm --filter @onelauncher/common -- ",
"scripts": "pnpm --filter @onelauncher/scripts -- ",
"format": "pnpm format:es && pnpm format:rs",
"format:es": "pnpm lint:es --fix",
"format:es": "pnpm lint:apps:es --fix && pnpm lint:packages:es --fix",
"format:rs": "cargo +nightly fmt && cargo clippy --fix",
"lint": "pnpm lint:es && pnpm lint:rs",
"lint:es": "eslint . --cache",
"lint:es": "pnpm lint:apps:es && pnpm lint:packages:es",
"lint:apps:es": "pnpm exec eslint apps/ --cache",
"lint:packages:es": "pnpm exec eslint packages/ --cache",
"lint:rs": "cargo +nightly fmt --check && cargo clippy -- -D warnings",
"prepare": "husky"
},
Expand Down
Loading