chore: merge changes

This commit is contained in:
emirsassan 2025-06-05 14:45:17 +03:00 • committed by LynithDev
parent 831514d8c7
commit 48105ee231
4 changed files with 26 additions and 38 deletions

View file

@ -12,7 +12,7 @@ function AccountPopup() {
const defaultUser = useCommand('getDefaultUser', () => bindings.core.getDefaultUser(false));
const setDefaultUser = (user: MinecraftCredentials) => {
bindings.core.setDefaultUser(user.id);
bindings.commands.setDefaultUser(user.id);
};
return (

View file

@ -22,7 +22,7 @@ function RouteComponent() {
const cluster = useCommand('getClusterById', () => bindings.core.getClusterById(Number(id.toString()) as unknown as bigint));
const isModded = cluster.data?.mc_loader != 'vanilla';
const isModded = cluster.data?.mc_loader !== 'vanilla';
return (
<div className="h-full flex flex-row overflow-hidden">
@ -32,12 +32,12 @@ function RouteComponent() {
links={{
'Cluster Settings': [
// if someone has a better way to do this, please let me know
[<EyeIcon />, 'Overview', `/?id=${id}`],
(isModded ? [<PackagePlusIcon />, 'Mods', `/mods?id=${id}`] : undefined),
[<Image03Icon />, 'Screenshots', `/screenshots?id=${id}`],
[<Globe04Icon />, 'Worlds', `/worlds?id=${id}`],
[<File06Icon />, 'Logs', `/logs?id=${id}`],
[<Settings04Icon />, 'Game Settings', `/settings?id=${id}`],
[<EyeIcon key="overview" />, 'Overview', `/?id=${id}`],
(isModded ? [<PackagePlusIcon key="mods" />, 'Mods', `/mods?id=${id}`] : undefined),
[<Image03Icon key="screenshots" />, 'Screenshots', `/screenshots?id=${id}`],
[<Globe04Icon key="worlds" />, 'Worlds', `/worlds?id=${id}`],
[<File06Icon key="logs" />, 'Logs', `/logs?id=${id}`],
[<Settings04Icon key="gamesettings" />, 'Game Settings', `/settings?id=${id}`],
],
}}
/>

View file

@ -15,19 +15,19 @@ function RouteComponent() {
base="/app/settings"
links={{
'Launcher Settings': [
[<Rocket02Icon />, 'General', '/'],
[<Brush01Icon />, 'Appearance', '/appearance'],
[<Rocket02Icon key="general" />, 'General', '/'],
[<Brush01Icon key="appearence" />, 'Appearance', '/appearance'],
// [<Key01Icon />, 'APIs', '/apis'],
// [<Globe01Icon />, 'Language', '/language'],
],
'Game Settings': [
[<Sliders04Icon />, 'Minecraft settings', '/minecraft'],
[<Users01Icon />, 'Accounts', '/accounts'],
[<Sliders04Icon key="mcsettings" />, 'Minecraft settings', '/minecraft'],
[<Users01Icon key="accounts" />, 'Accounts', '/accounts'],
],
'About': [
[<RefreshCcw02Icon />, 'Changelog', '/changelog'],
[<MessageTextSquare01Icon />, 'Feedback', '/feedback'],
[<CodeSnippet02Icon />, 'Developer Options', '/developer'],
[<RefreshCcw02Icon key="changelog" />, 'Changelog', '/changelog'],
[<MessageTextSquare01Icon key="feedback" />, 'Feedback', '/feedback'],
[<CodeSnippet02Icon key="dev" />, 'Developer Options', '/developer'],
],
}}
/>
@ -47,13 +47,15 @@ interface SidebarProps {
}
function Sidebar(props: SidebarProps) {
const { base, links } = props;
const navigate = useNavigate();
const routerState = useRouterState();
const location = routerState.location.pathname;
useEffect(() => {
if (props.base.endsWith('/'))
if (base.endsWith('/'))
throw new Error('Base should not end with a slash');
});
@ -63,24 +65,25 @@ function Sidebar(props: SidebarProps) {
for (const [key, value] of params)
currParams.set(key, value);
const url = `${props.base}${href}`;
const url = `${base}${href}`;
navigate({ to: url });
}
function isActive(link: string, _params: URLSearchParams | undefined) {
return location === `${props.base}${link}` || `${location}/` === `${props.base}${link}`;
return location === `${base}${link}` || `${location}/` === `${base}${link}`;
}
return (
<div className="w-56 flex flex-col pr-2">
{Object.keys(props.links).map((section, i) => (
{Object.keys(links).map((section, i) => (
<div className="flex flex-col gap-y-2" key={i}>
<div>
<h3 className="m-1.5 mt-5 text-xs text-fg-secondary font-medium">{section.toUpperCase()}</h3>
<div className="flex flex-col gap-y-1 fill-fg-primary text-fg-primary font-medium">
{props.links[section].map((link, i) => {
{links[section].map((link, i) => {
// eslint yaps too much tbh
if (!link)
return;
return '';
return (
<a

View file

@ -26,7 +26,7 @@ interface ImportInstancesType {
instances: Array<string>;
}
interface OnboardingContextType {
interface _OnboardingContextType {
setLanguage: (language: Language) => void;
language: () => Language;
@ -45,28 +45,18 @@ function RouteComponent() {
const currentPath = routerState.location.pathname;
const currentStepIndex = steps.findIndex(path => currentPath === path || currentPath.startsWith(path));
const progressPercentage = currentStepIndex >= 0 && steps.length > 1
const progressPercentage = currentStepIndex >= 0
? (currentStepIndex / (steps.length - 1)) * 100
: 0;
const handleBack = () => {
console.log('Geri için mevcut yol:', currentPath);
console.log('Geri için mevcut adım indeksi:', currentStepIndex);
if (currentStepIndex > 0) {
const previousStep = steps[currentStepIndex - 1];
console.log('Geri gidiliyor:', previousStep);
navigate({ to: previousStep as any });
}
else {
console.log('Zaten ilk adımda veya adım bulunamadı, geri gidilemez.');
}
};
const handleNext = () => {
console.log('İleri için mevcut yol:', currentPath);
console.log('İleri için mevcut adım indeksi:', currentStepIndex);
if (currentStepIndex === -1) {
navigate({ to: steps[0] as any });
return;
@ -74,16 +64,11 @@ function RouteComponent() {
if (currentStepIndex < steps.length - 1) {
const nextStep = steps[currentStepIndex + 1];
console.log('İleri gidiliyor:', nextStep);
navigate({ to: nextStep as any });
}
else if (currentStepIndex === steps.length - 1) {
console.log('Onboarding tamamlandı, /app adresine gidiliyor');
navigate({ to: '/app' as any });
}
else {
console.log('Bir sonraki adım belirlenemedi.');
}
};
return (