fix: fixed eslint errors
This commit is contained in:
parent
f26a596a78
commit
650014532a
14 changed files with 177 additions and 184 deletions
|
|
@ -1,17 +1,18 @@
|
|||
import type { MinecraftCredentials } from '@/bindings.gen';
|
||||
import PlayerHead from '@/components/content/PlayerHead';
|
||||
import {useCommand} from '@onelauncher/common';
|
||||
import { Button, Menu } from '@onelauncher/common/components';
|
||||
import { bindings } from '@/main';
|
||||
import { useCommand } from '@onelauncher/common';
|
||||
import { Button, Menu } from '@onelauncher/common/components';
|
||||
import { PlusIcon, Settings01Icon } from '@untitled-theme/icons-react';
|
||||
import { Separator } from 'react-aria-components';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
|
||||
function AccountPopup() {
|
||||
const users = useCommand('getUsers', bindings.commands.getUsers);
|
||||
const defaultUser = useCommand('getDefaultUser', () => bindings.commands.getDefaultUser(false));
|
||||
const users = useCommand('getUsers', bindings.core.get_users);
|
||||
const defaultUser = useCommand('getDefaultUser', () => bindings.core.get_default_user(false));
|
||||
|
||||
const setDefaultUser = (user: bindings.MinecraftCredentials) => {
|
||||
bindings.commands.setDefaultUser(user.id);
|
||||
const setDefaultUser = (user: MinecraftCredentials) => {
|
||||
bindings.core.set_default_user(user.id);
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
@ -64,7 +65,7 @@ function AccountEntry({
|
|||
loggedIn = false,
|
||||
}: {
|
||||
onClick: () => void;
|
||||
user: bindings.MinecraftCredentials;
|
||||
user: MinecraftCredentials;
|
||||
loggedIn?: boolean;
|
||||
}) {
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import type { Model } from '@/bindings.gen';
|
||||
import { bindings } from '@/main';
|
||||
import { useCommand } from '@onelauncher/common';
|
||||
import { useEffect, useState } from 'react';
|
||||
import useCommand from './useCommand';
|
||||
|
||||
function useRecentCluster() {
|
||||
const result = useCommand('getClusters', bindings.core.get_clusters);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Button, TextField } from '@onelauncher/common/components';
|
||||
import Modal from '@/components/overlay/Modal';
|
||||
import { Button, TextField } from '@onelauncher/common/components';
|
||||
import { createFileRoute } from '@tanstack/react-router';
|
||||
|
||||
export const Route = createFileRoute('/app/browser/')({
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ import type { Dispatch, SetStateAction } from 'react';
|
|||
import LoaderIcon from '@/components/launcher/LoaderIcon';
|
||||
import ScrollableContainer from '@/components/ScrollableContainer';
|
||||
import SettingsRow from '@/components/SettingsRow';
|
||||
import useCommand from '@/hooks/useCommand';
|
||||
import { bindings } from '@/main';
|
||||
import { useCommand } from '@onelauncher/common';
|
||||
import { Button, Show, TextField } from '@onelauncher/common/components';
|
||||
import { createFileRoute } from '@tanstack/react-router';
|
||||
import { Edit02Icon, FolderIcon, ImagePlusIcon, Share07Icon, Tool02Icon, Trash01Icon } from '@untitled-theme/icons-react';
|
||||
|
|
@ -21,7 +21,7 @@ function RouteComponent() {
|
|||
const [newName, setNewName] = useState<string>('');
|
||||
|
||||
// dumbass fix ik
|
||||
const cluster = useCommand('getClusterById', () => bindings.commands.getClusterById(Number(id.toString()) as unknown as bigint));
|
||||
const cluster = useCommand('getClusterById', () => bindings.core.get_cluster(Number(id.toString()) as unknown as bigint));
|
||||
|
||||
return (
|
||||
<Sidebar.Page>
|
||||
|
|
@ -119,17 +119,19 @@ function Banner(props: BannerProps) {
|
|||
// props.setNewCover(selected);
|
||||
// }
|
||||
|
||||
const { setNewName, editMode, cluster } = props;
|
||||
|
||||
function updateName(name: string) {
|
||||
if (name.length > 30 || name.length <= 0)
|
||||
return;
|
||||
|
||||
props.setNewName(name);
|
||||
setNewName(name);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="h-37 flex flex-row gap-x-2.5 rounded-xl bg-page-elevated p-2.5">
|
||||
<div className="relative aspect-ratio-video h-full min-w-57 w-57 overflow-hidden border border-component-bg/10 rounded-lg">
|
||||
<Show when={props.editMode}>
|
||||
<Show when={editMode}>
|
||||
<div
|
||||
className="absolute z-1 h-full w-full flex items-center justify-center bg-black/50 opacity-50 hover:opacity-100"
|
||||
// onClick={launchFilePicker}
|
||||
|
|
@ -146,37 +148,37 @@ function Banner(props: BannerProps) {
|
|||
<div>
|
||||
<Show
|
||||
fallback={
|
||||
<h2 className="break-words text-wrap text-2xl">{props.cluster?.name}</h2>
|
||||
<h2 className="break-words text-wrap text-2xl">{cluster?.name}</h2>
|
||||
}
|
||||
when={props.editMode}
|
||||
when={editMode}
|
||||
>
|
||||
<TextField
|
||||
className="text-xl font-bold"
|
||||
onChange={e => updateName(e.target.value)}
|
||||
placeholder={props.cluster?.name}
|
||||
placeholder={cluster?.name}
|
||||
/>
|
||||
</Show>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-1 flex-row">
|
||||
<div
|
||||
className={`flex flex-1 flex-col items-start justify-between ${props.editMode}` ? 'text-fg-primary-disabled' : ''}
|
||||
className={`flex flex-1 flex-col items-start justify-between ${editMode ? 'text-fg-primary-disabled' : ''}`}
|
||||
>
|
||||
<span className="flex flex-row items-center gap-x-1">
|
||||
<LoaderIcon
|
||||
className="w-5"
|
||||
loader={props.cluster?.mc_loader}
|
||||
loader={cluster?.mc_loader}
|
||||
/>
|
||||
<span>{props.cluster?.mc_version}</span>
|
||||
<span>{props.cluster?.mc_loader || 'unknown'}</span>
|
||||
{props.cluster?.mc_loader_version && <span>{props.cluster.mc_loader_version}</span>}
|
||||
<span>{cluster?.mc_version}</span>
|
||||
<span>{cluster?.mc_loader || 'unknown'}</span>
|
||||
{cluster?.mc_loader_version && <span>{cluster.mc_loader_version}</span>}
|
||||
</span>
|
||||
<span
|
||||
className={`text-xs text-fg-secondary ${props.editMode}` ? 'text-fg-secondary-disabled' : ''}
|
||||
className={`text-xs text-fg-secondary ${editMode ? 'text-fg-secondary-disabled' : ''}`}
|
||||
>
|
||||
Played for
|
||||
{' '}
|
||||
<b>{props.cluster?.overall_played || 0}</b>
|
||||
<b>{cluster?.overall_played || 0}</b>
|
||||
.
|
||||
</span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,52 +1,52 @@
|
|||
import { createFileRoute, Outlet } from '@tanstack/react-router'
|
||||
import Sidebar from '../settings/route'
|
||||
import { EyeIcon, File06Icon, Globe04Icon, Image03Icon, PackagePlusIcon, Settings04Icon } from '@untitled-theme/icons-react'
|
||||
import useCommand from '@/hooks/useCommand'
|
||||
import { bindings } from '@/main'
|
||||
import { bindings } from '@/main';
|
||||
import { useCommand } from '@onelauncher/common';
|
||||
import { createFileRoute, Outlet } from '@tanstack/react-router';
|
||||
import { EyeIcon, File06Icon, Globe04Icon, Image03Icon, PackagePlusIcon, Settings04Icon } from '@untitled-theme/icons-react';
|
||||
import Sidebar from '../settings/route';
|
||||
|
||||
type ClusterSearch = {
|
||||
id: bigint
|
||||
interface ClusterSearch {
|
||||
id: bigint;
|
||||
}
|
||||
|
||||
export const Route = createFileRoute('/app/cluster')({
|
||||
component: RouteComponent,
|
||||
validateSearch: (search: Record<string, unknown>): ClusterSearch => {
|
||||
return {
|
||||
id: BigInt(search.id as string),
|
||||
}
|
||||
},
|
||||
})
|
||||
component: RouteComponent,
|
||||
validateSearch: (search: Record<string, unknown>): ClusterSearch => {
|
||||
return {
|
||||
id: BigInt(search.id as string),
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
function RouteComponent() {
|
||||
const { id } = Route.useSearch()
|
||||
const { id } = Route.useSearch();
|
||||
|
||||
const cluster = useCommand("getClusterById", () => bindings.commands.getClusterById(Number(id.toString()) as unknown as bigint))
|
||||
const cluster = useCommand('getClusterById', () => bindings.core.get_cluster(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">
|
||||
<div className="flex-shrink-0 w-72 flex flex-col pt-8 pr-7 pb-8">
|
||||
<Sidebar
|
||||
base="/app/cluster"
|
||||
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],
|
||||
],
|
||||
}}
|
||||
/>
|
||||
{/* <Info /> */}
|
||||
</div>
|
||||
return (
|
||||
<div className="h-full flex flex-row overflow-hidden">
|
||||
<div className="flex-shrink-0 w-72 flex flex-col pt-8 pr-7 pb-8">
|
||||
<Sidebar
|
||||
base="/app/cluster"
|
||||
links={{
|
||||
'Cluster Settings': [
|
||||
// if someone has a better way to do this, please let me know
|
||||
[<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}`],
|
||||
],
|
||||
}}
|
||||
/>
|
||||
{/* <Info /> */}
|
||||
</div>
|
||||
|
||||
<div className="flex-1 min-w-0 h-full">
|
||||
<Outlet />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
<div className="flex-1 min-w-0 h-full">
|
||||
<Outlet />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,46 +1,48 @@
|
|||
import { createFileRoute } from '@tanstack/react-router'
|
||||
import Sidebar from '../settings/route';
|
||||
import ScrollableContainer from '@/components/ScrollableContainer';
|
||||
import { Show } from '@/components/base/Show';
|
||||
import { Show } from '@onelauncher/common/components';
|
||||
import { createFileRoute } from '@tanstack/react-router';
|
||||
import Sidebar from '../settings/route';
|
||||
|
||||
export const Route = createFileRoute('/app/cluster/screenshots')({
|
||||
component: RouteComponent,
|
||||
})
|
||||
component: RouteComponent,
|
||||
});
|
||||
|
||||
function RouteComponent() {
|
||||
const arr = [1, 2, 3, 4, 5, 6]
|
||||
return (
|
||||
<Sidebar.Page>
|
||||
<h1>Screenshots</h1>
|
||||
<ScrollableContainer>
|
||||
<div className="h-full">
|
||||
<Show
|
||||
fallback={<div className="text-border/400">No screenshots found. Press F2 in game to take a screenshot!</div>}
|
||||
when={true}
|
||||
>
|
||||
<div className="grid grid-cols-[repeat(auto-fill,minmax(350px,1fr))] w-full transform-gpu gap-2">
|
||||
{arr.map((data) => (
|
||||
<ScreenshotEntry key={data} path={`screenshot-${data}.png`} cluster_path="cluster" />
|
||||
))}
|
||||
</div>
|
||||
</Show>
|
||||
</div>
|
||||
</ScrollableContainer>
|
||||
</Sidebar.Page>
|
||||
)
|
||||
const arr = [1, 2, 3, 4, 5, 6];
|
||||
return (
|
||||
<Sidebar.Page>
|
||||
<h1>Screenshots</h1>
|
||||
<ScrollableContainer>
|
||||
<div className="h-full">
|
||||
<Show
|
||||
fallback={<div className="text-border/400">No screenshots found. Press F2 in game to take a screenshot!</div>}
|
||||
when
|
||||
>
|
||||
<div className="grid grid-cols-[repeat(auto-fill,minmax(350px,1fr))] w-full transform-gpu gap-2">
|
||||
{arr.map(data => (
|
||||
<ScreenshotEntry cluster_path="cluster" key={data} path={`screenshot-${data}.png`} />
|
||||
))}
|
||||
</div>
|
||||
</Show>
|
||||
</div>
|
||||
</ScrollableContainer>
|
||||
</Sidebar.Page>
|
||||
);
|
||||
}
|
||||
|
||||
function ScreenshotEntry(props: { path: string; cluster_path: string }) {
|
||||
function onClick() {
|
||||
//screen shot viewer overlay
|
||||
}
|
||||
function onClick() {
|
||||
// screen shot viewer overlay
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className="flex flex-col items-center gap-3 rounded-xl bg-component-bg p-3 active:bg-component-bg-pressed hover:bg-component-bg-hover hover:opacity-80"
|
||||
onClick={onClick}
|
||||
>
|
||||
<img alt={props.path} className="aspect-video w-full rounded-lg" src="https://github.com/emirsassan.png" />
|
||||
</div>
|
||||
);
|
||||
const { path } = props;
|
||||
|
||||
return (
|
||||
<div
|
||||
className="flex flex-col items-center gap-3 rounded-xl bg-component-bg p-3 active:bg-component-bg-pressed hover:bg-component-bg-hover hover:opacity-80"
|
||||
onClick={onClick}
|
||||
>
|
||||
<img alt={path} className="aspect-video w-full rounded-lg" src="https://github.com/emirsassan.png" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,35 +1,33 @@
|
|||
import { createFileRoute } from '@tanstack/react-router'
|
||||
import Sidebar from '../settings/route'
|
||||
import ScrollableContainer from '@/components/ScrollableContainer'
|
||||
import useCommand from '@/hooks/useCommand'
|
||||
import { bindings } from '@/main'
|
||||
import { GameSettings, ProcessSettings } from '../settings/minecraft'
|
||||
import ScrollableContainer from '@/components/ScrollableContainer';
|
||||
import { bindings } from '@/main';
|
||||
import { useCommand } from '@onelauncher/common';
|
||||
import { createFileRoute } from '@tanstack/react-router';
|
||||
import { GameSettings, ProcessSettings } from '../settings/minecraft';
|
||||
import Sidebar from '../settings/route';
|
||||
|
||||
export const Route = createFileRoute('/app/cluster/settings')({
|
||||
component: RouteComponent,
|
||||
})
|
||||
component: RouteComponent,
|
||||
});
|
||||
|
||||
function RouteComponent() {
|
||||
const { id } = Route.useSearch()
|
||||
const { id } = Route.useSearch();
|
||||
|
||||
const cluster = useCommand("getClusterById", () => bindings.commands.getClusterById(Number(id.toString()) as unknown as bigint))
|
||||
const result = useCommand("getProfileOrDefault", () => bindings.commands.getProfileOrDefault(cluster.data?.name as string), {
|
||||
enabled: !!cluster.data?.name
|
||||
})
|
||||
const cluster = useCommand('getClusterById', () => bindings.core.get_cluster(Number(id.toString()) as unknown as bigint));
|
||||
const _result = useCommand('getProfileOrDefault', () => bindings.core.get_profile_or_default(cluster.data?.name as string), {
|
||||
enabled: !!cluster.data?.name,
|
||||
});
|
||||
|
||||
console.log(result.data)
|
||||
return (
|
||||
<Sidebar.Page>
|
||||
<ScrollableContainer>
|
||||
<div className="h-full">
|
||||
<h1>Minecraft Settings</h1>
|
||||
|
||||
return (
|
||||
<Sidebar.Page>
|
||||
<ScrollableContainer>
|
||||
<div className="h-full">
|
||||
<h1>Minecraft Settings</h1>
|
||||
<GameSettings />
|
||||
|
||||
<GameSettings />
|
||||
|
||||
<ProcessSettings />
|
||||
</div>
|
||||
</ScrollableContainer>
|
||||
</Sidebar.Page>
|
||||
)
|
||||
<ProcessSettings />
|
||||
</div>
|
||||
</ScrollableContainer>
|
||||
</Sidebar.Page>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,20 @@
|
|||
import { createFileRoute } from '@tanstack/react-router'
|
||||
import Sidebar from '../settings/route'
|
||||
import ScrollableContainer from '@/components/ScrollableContainer'
|
||||
import ScrollableContainer from '@/components/ScrollableContainer';
|
||||
import { createFileRoute } from '@tanstack/react-router';
|
||||
import Sidebar from '../settings/route';
|
||||
|
||||
export const Route = createFileRoute('/app/cluster/worlds')({
|
||||
component: RouteComponent,
|
||||
})
|
||||
component: RouteComponent,
|
||||
});
|
||||
|
||||
function RouteComponent() {
|
||||
return (
|
||||
<Sidebar.Page>
|
||||
<h1>Worlds</h1>
|
||||
<ScrollableContainer>
|
||||
<div className="h-full">
|
||||
|
||||
</div>
|
||||
</ScrollableContainer>
|
||||
</Sidebar.Page>
|
||||
)
|
||||
return (
|
||||
<Sidebar.Page>
|
||||
<h1>Worlds</h1>
|
||||
<ScrollableContainer>
|
||||
<div className="h-full">
|
||||
|
||||
</div>
|
||||
</ScrollableContainer>
|
||||
</Sidebar.Page>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import PlayerHead from '@/components/content/PlayerHead';
|
||||
import ScrollableContainer from '@/components/ScrollableContainer';
|
||||
import useCommand from '@/hooks/useCommand';
|
||||
import { bindings } from '@/main';
|
||||
import { useCommand } from '@onelauncher/common';
|
||||
import { Button, Show, Tooltip } from '@onelauncher/common/components';
|
||||
import { createFileRoute } from '@tanstack/react-router';
|
||||
import { InfoCircleIcon, Trash01Icon, UserPlus02Icon } from '@untitled-theme/icons-react';
|
||||
|
|
@ -18,8 +18,8 @@ interface Account {
|
|||
}
|
||||
|
||||
function RouteComponent() {
|
||||
const { data: usersData, isLoading: usersLoading } = useCommand('getUsers', bindings.commands.getUsers);
|
||||
const { data: defaultUserData, isLoading: defaultUserLoading } = useCommand('getDefaultUser', () => bindings.commands.getDefaultUser(false));
|
||||
const { data: usersData, isLoading: usersLoading } = useCommand('getUsers', bindings.core.get_users);
|
||||
const { data: defaultUserData, isLoading: defaultUserLoading } = useCommand('getDefaultUser', () => bindings.core.get_default_user(false));
|
||||
|
||||
if (usersLoading || defaultUserLoading)
|
||||
return (
|
||||
|
|
@ -67,7 +67,7 @@ function AccountRow({ account, isCurrent }: AccountRowProps) {
|
|||
|
||||
const setDefaultUserCommand = useCommand(
|
||||
'setDefaultUser',
|
||||
() => bindings.commands.setDefaultUser(account.id),
|
||||
() => bindings.core.set_default_user(account.id),
|
||||
{
|
||||
enabled: false,
|
||||
subscribed: false,
|
||||
|
|
@ -76,7 +76,7 @@ function AccountRow({ account, isCurrent }: AccountRowProps) {
|
|||
|
||||
const removeUserCommand = useCommand(
|
||||
'removeUser',
|
||||
() => bindings.commands.removeUser(account.id),
|
||||
() => bindings.core.remove_user(account.id),
|
||||
{
|
||||
enabled: false,
|
||||
subscribed: false,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ export const Route = createFileRoute('/app/settings/')({
|
|||
});
|
||||
|
||||
function RouteComponent() {
|
||||
const result = useCommand('getGlobalProfile', bindings.commands.getGlobalProfile);
|
||||
const _result = useCommand('getGlobalProfile', bindings.core.get_global_profile);
|
||||
|
||||
return (
|
||||
<Sidebar.Page>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import ScrollableContainer from '@/components/ScrollableContainer';
|
||||
import SettingsRow from '@/components/SettingsRow';
|
||||
import { Switch, TextField, ToggleButton } from '@onelauncher/common/components';
|
||||
import { Switch, TextField } from '@onelauncher/common/components';
|
||||
import { createFileRoute } from '@tanstack/react-router';
|
||||
import { Database01Icon, EyeIcon, FilePlus02Icon, FileX02Icon, LayoutTopIcon, Maximize01Icon, ParagraphWrapIcon, XIcon } from '@untitled-theme/icons-react';
|
||||
import { Database01Icon, FilePlus02Icon, FileX02Icon, LayoutTopIcon, Maximize01Icon, ParagraphWrapIcon, XIcon } from '@untitled-theme/icons-react';
|
||||
import Sidebar from './route';
|
||||
|
||||
export const Route = createFileRoute('/app/settings/minecraft')({
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ export const Route = createFileRoute('/onboarding/login')({
|
|||
function RouteComponent() {
|
||||
const [profile, setProfile] = useState<MinecraftCredentials>();
|
||||
const [errorMessage, setErrorMessage] = useState<string>('');
|
||||
const result = useCommand('beginMsFlow', bindings.commands.beginMsFlow, {
|
||||
const result = useCommand('beginMsFlow', bindings.core.open_msa_login, {
|
||||
enabled: false,
|
||||
subscribed: false,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
|
|
@ -121,20 +106,22 @@ export interface OnboardingStepProps {
|
|||
}
|
||||
|
||||
export function OnboardingStep(props: OnboardingStepProps) {
|
||||
const { illustration, title, paragraph, children } = props;
|
||||
|
||||
return (
|
||||
<div className="grid grid-cols-2 h-full w-full gap-x-16">
|
||||
<div className="flex flex-col items-center justify-center">
|
||||
{props.illustration}
|
||||
{illustration}
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col justify-center gap-y-4">
|
||||
<div className="w-full flex flex-col gap-y-2">
|
||||
<h1 className="text-2xl">{props.title}</h1>
|
||||
<p className="text-lg text-fg-secondary line-height-normal">{props.paragraph}</p>
|
||||
<h1 className="text-2xl">{title}</h1>
|
||||
<p className="text-lg text-fg-secondary line-height-normal">{paragraph}</p>
|
||||
</div>
|
||||
|
||||
<div className="max-h-96 w-full flex flex-1 flex-col gap-y-2">
|
||||
{props.children}
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue