mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2025-11-13 00:02:41 +10:00
feat: prototype big picture mode
This commit is contained in:
13
main/app.vue
13
main/app.vue
@ -1,21 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<NuxtLoadingIndicator color="#2563eb" />
|
<NuxtLoadingIndicator color="#2563eb" />
|
||||||
<NuxtLayout ref="rootNode" class="select-none w-screen h-screen">
|
<NuxtLayout class="select-none w-screen h-screen">
|
||||||
<NuxtPage />
|
<NuxtPage />
|
||||||
<ModalStack />
|
<ModalStack />
|
||||||
</NuxtLayout>
|
</NuxtLayout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import "~/composables/downloads.js";
|
|
||||||
|
|
||||||
import { invoke } from "@tauri-apps/api/core";
|
import { invoke } from "@tauri-apps/api/core";
|
||||||
import { useAppState } from "./composables/app-state.js";
|
|
||||||
import {
|
|
||||||
initialNavigation,
|
|
||||||
setupHooks,
|
|
||||||
} from "./composables/state-navigation.js";
|
|
||||||
import { createTVNavigator } from "./composables/tvmode.js";
|
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
@ -42,9 +34,6 @@ router.beforeEach(async () => {
|
|||||||
await fetchState();
|
await fetchState();
|
||||||
});
|
});
|
||||||
|
|
||||||
const rootNode = ref<HTMLElement>();
|
|
||||||
const navigator = createTVNavigator(rootNode);
|
|
||||||
|
|
||||||
setupHooks();
|
setupHooks();
|
||||||
initialNavigation(state);
|
initialNavigation(state);
|
||||||
|
|
||||||
|
|||||||
@ -76,7 +76,6 @@ import { Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/vue";
|
|||||||
import { ChevronDownIcon } from "@heroicons/vue/16/solid";
|
import { ChevronDownIcon } from "@heroicons/vue/16/solid";
|
||||||
import type { NavigationItem } from "../types";
|
import type { NavigationItem } from "../types";
|
||||||
import HeaderWidget from "./HeaderWidget.vue";
|
import HeaderWidget from "./HeaderWidget.vue";
|
||||||
import { useAppState } from "~/composables/app-state";
|
|
||||||
import { invoke } from "@tauri-apps/api/core";
|
import { invoke } from "@tauri-apps/api/core";
|
||||||
|
|
||||||
const open = ref(false);
|
const open = ref(false);
|
||||||
|
|||||||
@ -73,7 +73,7 @@
|
|||||||
alt=""
|
alt=""
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="inline-flex items-center gap-x-2">
|
<div class="flex flex-col gap-x-2">
|
||||||
<p
|
<p
|
||||||
class="text-sm whitespace-nowrap font-display font-semibold"
|
class="text-sm whitespace-nowrap font-display font-semibold"
|
||||||
>
|
>
|
||||||
|
|||||||
@ -1,7 +0,0 @@
|
|||||||
<template>
|
|
||||||
<NuxtLink
|
|
||||||
class="inline-flex items-center gap-x-2 px-1 py-0.5 rounded bg-blue-900 text-zinc-100 hover:bg-blue-800"
|
|
||||||
>
|
|
||||||
<slot />
|
|
||||||
</NuxtLink>
|
|
||||||
</template>
|
|
||||||
@ -9,11 +9,9 @@ export default defineNuxtConfig({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
css: ["~/assets/main.scss"],
|
|
||||||
|
|
||||||
ssr: false,
|
ssr: false,
|
||||||
|
|
||||||
extends: [["../libs/drop-base"]],
|
extends: ["../shared", "../libs/drop-base"],
|
||||||
|
|
||||||
app: {
|
app: {
|
||||||
baseURL: "/main",
|
baseURL: "/main",
|
||||||
@ -22,4 +20,6 @@ export default defineNuxtConfig({
|
|||||||
devtools: {
|
devtools: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -7,6 +7,7 @@ export default {
|
|||||||
"./plugins/**/*.{js,ts}",
|
"./plugins/**/*.{js,ts}",
|
||||||
"./app.vue",
|
"./app.vue",
|
||||||
"./error.vue",
|
"./error.vue",
|
||||||
|
"../shared/components/**/*.vue"
|
||||||
],
|
],
|
||||||
theme: {
|
theme: {
|
||||||
extend: {
|
extend: {
|
||||||
|
|||||||
50
shared/app.vue
Normal file
50
shared/app.vue
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<template>
|
||||||
|
<NuxtLoadingIndicator color="#2563eb" />
|
||||||
|
<NuxtLayout class="select-none w-screen h-screen">
|
||||||
|
<NuxtPage />
|
||||||
|
<ModalStack />
|
||||||
|
</NuxtLayout>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import "~/composables/downloads.js";
|
||||||
|
|
||||||
|
import { invoke } from "@tauri-apps/api/core";
|
||||||
|
import { useAppState } from "./composables/app-state.js";
|
||||||
|
import {
|
||||||
|
initialNavigation,
|
||||||
|
setupHooks,
|
||||||
|
} from "./composables/state-navigation.js";
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
const state = useAppState();
|
||||||
|
|
||||||
|
async function fetchState() {
|
||||||
|
try {
|
||||||
|
state.value = JSON.parse(await invoke("fetch_state"));
|
||||||
|
if (!state.value)
|
||||||
|
throw createError({
|
||||||
|
statusCode: 500,
|
||||||
|
statusMessage: `App state is: ${state.value}`,
|
||||||
|
fatal: true,
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.error("failed to parse state", e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await fetchState();
|
||||||
|
|
||||||
|
// This is inefficient but apparently we do it lol
|
||||||
|
router.beforeEach(async () => {
|
||||||
|
await fetchState();
|
||||||
|
});
|
||||||
|
|
||||||
|
setupHooks();
|
||||||
|
initialNavigation(state);
|
||||||
|
|
||||||
|
useHead({
|
||||||
|
title: "Drop",
|
||||||
|
});
|
||||||
|
</script>
|
||||||
84
shared/assets/main.scss
Normal file
84
shared/assets/main.scss
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
@tailwind base;
|
||||||
|
@tailwind components;
|
||||||
|
@tailwind utilities;
|
||||||
|
|
||||||
|
html,
|
||||||
|
body {
|
||||||
|
-ms-overflow-style: none; /* IE and Edge /
|
||||||
|
scrollbar-width: none; / Firefox */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hide scrollbar for Chrome, Safari and Opera */
|
||||||
|
html::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
$motiva: (
|
||||||
|
("MotivaSansThin.ttf", "ttf", 100, normal),
|
||||||
|
("MotivaSansLight.woff.ttf", "woff", 300, normal),
|
||||||
|
("MotivaSansRegular.woff.ttf", "woff", 400, normal),
|
||||||
|
("MotivaSansMedium.woff.ttf", "woff", 500, normal),
|
||||||
|
("MotivaSansBold.woff.ttf", "woff", 600, normal),
|
||||||
|
("MotivaSansExtraBold.ttf", "woff", 700, normal),
|
||||||
|
("MotivaSansBlack.woff.ttf", "woff", 900, normal)
|
||||||
|
);
|
||||||
|
|
||||||
|
$helvetica: (
|
||||||
|
("Helvetica.woff", "woff", 400, normal),
|
||||||
|
("Helvetica-Oblique.woff", "woff", 400, italic),
|
||||||
|
("Helvetica-Bold.woff", "woff", 600, normal),
|
||||||
|
("Helvetica-BoldOblique.woff", "woff", 600, italic),
|
||||||
|
("helvetica-light-587ebe5a59211.woff2", "woff2", 300, normal)
|
||||||
|
);
|
||||||
|
|
||||||
|
@each $file, $format, $weight, $style in $motiva {
|
||||||
|
@font-face {
|
||||||
|
font-family: "Motiva Sans";
|
||||||
|
src: url("/fonts/motiva/#{$file}") format($format);
|
||||||
|
font-weight: $weight;
|
||||||
|
font-style: $style;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@each $file, $format, $weight, $style in $helvetica {
|
||||||
|
@font-face {
|
||||||
|
font-family: "Helvetica";
|
||||||
|
src: url("/fonts/helvetica/#{$file}") format($format);
|
||||||
|
font-weight: $weight;
|
||||||
|
font-style: $style;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "Inter";
|
||||||
|
src: url("/fonts/inter/InterVariable.ttf");
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "Inter";
|
||||||
|
src: url("/fonts/inter/InterVariable-Italic.ttf");
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Scrollbar CSS ===== */
|
||||||
|
/* Firefox */
|
||||||
|
* {
|
||||||
|
scrollbar-width: 4px;
|
||||||
|
scrollbar-color: #52525b #00000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Chrome, Edge, and Safari */
|
||||||
|
*::-webkit-scrollbar {
|
||||||
|
width: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
*::-webkit-scrollbar-track {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
*::-webkit-scrollbar-thumb {
|
||||||
|
background-color: #52525b;
|
||||||
|
border-radius: 10px;
|
||||||
|
border: 3px solid #52525b;
|
||||||
|
}
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import { convertFileSrc } from "@tauri-apps/api/core";
|
import { convertFileSrc } from "@tauri-apps/api/core";
|
||||||
|
|
||||||
export const useObject = async (id: string) => {
|
export const useObject = (id: string) => {
|
||||||
return convertFileSrc(id, "object");
|
return convertFileSrc(id, "object");
|
||||||
};
|
};
|
||||||
91
shared/error.vue
Normal file
91
shared/error.vue
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
<template>
|
||||||
|
<NuxtLayout name="default">
|
||||||
|
<div
|
||||||
|
class="grid min-h-full grid-cols-1 grid-rows-[1fr,auto,1fr] lg:grid-cols-[max(50%,36rem),1fr]"
|
||||||
|
>
|
||||||
|
<header
|
||||||
|
class="mx-auto w-full max-w-7xl px-6 pt-6 sm:pt-10 lg:col-span-2 lg:col-start-1 lg:row-start-1 lg:px-8"
|
||||||
|
>
|
||||||
|
<Logo class="h-10 w-auto sm:h-12" />
|
||||||
|
|
||||||
|
</header>
|
||||||
|
<main
|
||||||
|
class="mx-auto w-full max-w-7xl px-6 py-24 sm:py-32 lg:col-span-2 lg:col-start-1 lg:row-start-2 lg:px-8"
|
||||||
|
>
|
||||||
|
<div class="max-w-lg">
|
||||||
|
<p class="text-base font-semibold leading-8 text-blue-600">
|
||||||
|
{{ error?.statusCode }}
|
||||||
|
</p>
|
||||||
|
<h1
|
||||||
|
class="mt-4 text-3xl font-bold font-display tracking-tight text-zinc-100 sm:text-5xl"
|
||||||
|
>
|
||||||
|
Oh no!
|
||||||
|
</h1>
|
||||||
|
<p
|
||||||
|
v-if="message"
|
||||||
|
class="mt-3 font-bold text-base leading-7 text-red-500"
|
||||||
|
>
|
||||||
|
{{ message }}
|
||||||
|
</p>
|
||||||
|
<p class="mt-6 text-base leading-7 text-zinc-400">
|
||||||
|
An error occurred while responding to your request. If you believe
|
||||||
|
this to be a bug, please report it. Try signing in and see if it
|
||||||
|
resolves the issue.
|
||||||
|
</p>
|
||||||
|
<div class="mt-10">
|
||||||
|
<!-- full app reload to fix errors -->
|
||||||
|
<a
|
||||||
|
href="/store"
|
||||||
|
class="text-sm font-semibold leading-7 text-blue-600"
|
||||||
|
><span aria-hidden="true">←</span> Back to store</a
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<footer class="self-end lg:col-span-2 lg:col-start-1 lg:row-start-3">
|
||||||
|
<div class="border-t border-zinc-700 bg-zinc-900 py-10">
|
||||||
|
<nav
|
||||||
|
class="mx-auto flex w-full max-w-7xl items-center gap-x-4 px-6 text-sm leading-7 text-zinc-400 lg:px-8"
|
||||||
|
>
|
||||||
|
<NuxtLink href="/docs">Documentation</NuxtLink>
|
||||||
|
<svg
|
||||||
|
viewBox="0 0 2 2"
|
||||||
|
aria-hidden="true"
|
||||||
|
class="h-0.5 w-0.5 fill-zinc-600"
|
||||||
|
>
|
||||||
|
<circle cx="1" cy="1" r="1" />
|
||||||
|
</svg>
|
||||||
|
<a href="https://discord.gg/NHx46XKJWA" target="_blank"
|
||||||
|
>Support Discord</a
|
||||||
|
>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
<div
|
||||||
|
class="hidden lg:relative lg:col-start-2 lg:row-start-1 lg:row-end-4 lg:block"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src="@/assets/wallpaper.jpg"
|
||||||
|
alt=""
|
||||||
|
class="absolute inset-0 h-full w-full object-cover"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</NuxtLayout>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { NuxtError } from "#app";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
error: Object as () => NuxtError,
|
||||||
|
});
|
||||||
|
|
||||||
|
const statusCode = props.error?.statusCode;
|
||||||
|
const message =
|
||||||
|
props.error?.statusMessage ||
|
||||||
|
props.error?.message ||
|
||||||
|
"An unknown error occurred.";
|
||||||
|
|
||||||
|
console.error(props.error);
|
||||||
|
</script>
|
||||||
25
shared/nuxt.config.ts
Normal file
25
shared/nuxt.config.ts
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
// https://nuxt.com/docs/api/configuration/nuxt-config
|
||||||
|
export default defineNuxtConfig({
|
||||||
|
compatibilityDate: "2024-04-03",
|
||||||
|
|
||||||
|
postcss: {
|
||||||
|
plugins: {
|
||||||
|
tailwindcss: {},
|
||||||
|
autoprefixer: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
css: ["~/assets/main.scss"],
|
||||||
|
|
||||||
|
ssr: false,
|
||||||
|
|
||||||
|
extends: [["../libs/drop-base"]],
|
||||||
|
|
||||||
|
app: {
|
||||||
|
baseURL: "/main",
|
||||||
|
},
|
||||||
|
|
||||||
|
devtools: {
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
37
shared/package.json
Normal file
37
shared/package.json
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
{
|
||||||
|
"name": "view",
|
||||||
|
"private": true,
|
||||||
|
"version": "0.3.3",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"build": "nuxt generate",
|
||||||
|
"dev": "nuxt dev",
|
||||||
|
"postinstall": "nuxt prepare",
|
||||||
|
"tauri": "tauri"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@headlessui/vue": "^1.7.23",
|
||||||
|
"@heroicons/vue": "^2.1.5",
|
||||||
|
"@nuxtjs/tailwindcss": "^6.12.2",
|
||||||
|
"@tauri-apps/api": "^2.7.0",
|
||||||
|
"koa": "^2.16.1",
|
||||||
|
"markdown-it": "^14.1.0",
|
||||||
|
"micromark": "^4.0.1",
|
||||||
|
"nuxt": "^3.16.0",
|
||||||
|
"scss": "^0.2.4",
|
||||||
|
"vue-router": "latest",
|
||||||
|
"vuedraggable": "^4.1.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@tailwindcss/forms": "^0.5.9",
|
||||||
|
"@tailwindcss/typography": "^0.5.15",
|
||||||
|
"@types/markdown-it": "^14.1.2",
|
||||||
|
"autoprefixer": "^10.4.20",
|
||||||
|
"postcss": "^8.4.47",
|
||||||
|
"sass-embedded": "^1.79.4",
|
||||||
|
"tailwindcss": "^3.4.13",
|
||||||
|
"typescript": "^5.8.3",
|
||||||
|
"vue-tsc": "^2.2.10"
|
||||||
|
},
|
||||||
|
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
||||||
|
}
|
||||||
20
shared/tailwind.config.js
Normal file
20
shared/tailwind.config.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/** @type {import('tailwindcss').Config} */
|
||||||
|
export default {
|
||||||
|
content: [
|
||||||
|
"./components/**/*.{js,vue,ts}",
|
||||||
|
"./layouts/**/*.vue",
|
||||||
|
"./pages/**/*.vue",
|
||||||
|
"./plugins/**/*.{js,ts}",
|
||||||
|
"./app.vue",
|
||||||
|
"./error.vue",
|
||||||
|
],
|
||||||
|
theme: {
|
||||||
|
extend: {
|
||||||
|
fontFamily: {
|
||||||
|
sans: ["Inter"],
|
||||||
|
display: ["Motiva Sans"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
plugins: [require("@tailwindcss/forms"), require('@tailwindcss/typography')],
|
||||||
|
};
|
||||||
5
shared/tsconfig.json
Normal file
5
shared/tsconfig.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
// https://nuxt.com/docs/guide/concepts/typescript
|
||||||
|
"extends": "./.nuxt/tsconfig.json",
|
||||||
|
"exclude": ["src-tauri/**/*"]
|
||||||
|
}
|
||||||
96
shared/types.ts
Normal file
96
shared/types.ts
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
import type { Component } from "vue";
|
||||||
|
|
||||||
|
export type NavigationItem = {
|
||||||
|
prefix: string;
|
||||||
|
route: string;
|
||||||
|
label: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type QuickActionNav = {
|
||||||
|
icon: Component;
|
||||||
|
notifications?: number;
|
||||||
|
action: () => Promise<void>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type User = {
|
||||||
|
id: string;
|
||||||
|
username: string;
|
||||||
|
admin: boolean;
|
||||||
|
displayName: string;
|
||||||
|
profilePictureObjectId: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type AppState = {
|
||||||
|
status: AppStatus;
|
||||||
|
user?: User;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Game = {
|
||||||
|
id: string;
|
||||||
|
mName: string;
|
||||||
|
mShortDescription: string;
|
||||||
|
mDescription: string;
|
||||||
|
mIconObjectId: string;
|
||||||
|
mBannerObjectId: string;
|
||||||
|
mCoverObjectId: string;
|
||||||
|
mImageLibraryObjectIds: string[];
|
||||||
|
mImageCarouselObjectIds: string[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Collection = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
isDefault: boolean;
|
||||||
|
entries: Array<{ gameId: string; game: Game }>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type GameVersion = {
|
||||||
|
launchCommandTemplate: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export enum AppStatus {
|
||||||
|
NotConfigured = "NotConfigured",
|
||||||
|
Offline = "Offline",
|
||||||
|
SignedOut = "SignedOut",
|
||||||
|
SignedIn = "SignedIn",
|
||||||
|
SignedInNeedsReauth = "SignedInNeedsReauth",
|
||||||
|
ServerUnavailable = "ServerUnavailable",
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum GameStatusEnum {
|
||||||
|
Remote = "Remote",
|
||||||
|
Queued = "Queued",
|
||||||
|
Downloading = "Downloading",
|
||||||
|
Validating = "Validating",
|
||||||
|
Installed = "Installed",
|
||||||
|
Updating = "Updating",
|
||||||
|
Uninstalling = "Uninstalling",
|
||||||
|
SetupRequired = "SetupRequired",
|
||||||
|
Running = "Running",
|
||||||
|
PartiallyInstalled = "PartiallyInstalled",
|
||||||
|
}
|
||||||
|
|
||||||
|
export type GameStatus = {
|
||||||
|
type: GameStatusEnum;
|
||||||
|
version_name?: string;
|
||||||
|
install_dir?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export enum DownloadableType {
|
||||||
|
Game = "Game",
|
||||||
|
Tool = "Tool",
|
||||||
|
DLC = "DLC",
|
||||||
|
Mod = "Mod",
|
||||||
|
}
|
||||||
|
|
||||||
|
export type DownloadableMetadata = {
|
||||||
|
id: string;
|
||||||
|
version: string;
|
||||||
|
downloadType: DownloadableType;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Settings = {
|
||||||
|
autostart: boolean;
|
||||||
|
maxDownloadThreads: number;
|
||||||
|
forceOffline: boolean;
|
||||||
|
};
|
||||||
8091
shared/yarn.lock
Normal file
8091
shared/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
@ -361,7 +361,7 @@ pub fn run() {
|
|||||||
let _main_window = tauri::WebviewWindowBuilder::new(
|
let _main_window = tauri::WebviewWindowBuilder::new(
|
||||||
&handle,
|
&handle,
|
||||||
"main", // BTW this is not the name of the window, just the label. Keep this 'main', there are permissions & configs that depend on it
|
"main", // BTW this is not the name of the window, just the label. Keep this 'main', there are permissions & configs that depend on it
|
||||||
tauri::WebviewUrl::App("main".into()),
|
tauri::WebviewUrl::App("tvmode".into()),
|
||||||
)
|
)
|
||||||
.title("Drop Desktop App")
|
.title("Drop Desktop App")
|
||||||
.min_inner_size(1000.0, 500.0)
|
.min_inner_size(1000.0, 500.0)
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
"version": "0.3.3",
|
"version": "0.3.3",
|
||||||
"identifier": "dev.drop.client",
|
"identifier": "dev.drop.client",
|
||||||
"build": {
|
"build": {
|
||||||
"beforeDevCommand": "yarn --cwd main dev --port 1432",
|
"beforeDevCommand": "yarn --cwd tvmode dev --port 1432",
|
||||||
"devUrl": "http://localhost:1432/",
|
"devUrl": "http://localhost:1432/",
|
||||||
"beforeBuildCommand": "yarn build",
|
"beforeBuildCommand": "yarn build",
|
||||||
"frontendDist": "../.output"
|
"frontendDist": "../.output"
|
||||||
|
|||||||
@ -1,3 +1,40 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<NuxtLoadingIndicator color="#2563eb" />
|
||||||
|
<NuxtLayout class="select-none">
|
||||||
|
<NuxtPage />
|
||||||
|
<ModalStack />
|
||||||
|
</NuxtLayout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { invoke } from '@tauri-apps/api/core';
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
const state = useAppState();
|
||||||
|
|
||||||
|
async function fetchState() {
|
||||||
|
try {
|
||||||
|
state.value = JSON.parse(await invoke("fetch_state"));
|
||||||
|
if (!state.value)
|
||||||
|
throw createError({
|
||||||
|
statusCode: 500,
|
||||||
|
statusMessage: `App state is: ${state.value}`,
|
||||||
|
fatal: true,
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.error("failed to parse state", e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await fetchState();
|
||||||
|
|
||||||
|
// This is inefficient but apparently we do it lol
|
||||||
|
router.beforeEach(async () => {
|
||||||
|
await fetchState();
|
||||||
|
});
|
||||||
|
|
||||||
|
setupHooks();
|
||||||
|
initialNavigation(state);
|
||||||
|
const navigator = createTVNavigator();
|
||||||
|
</script>
|
||||||
|
|||||||
84
tvmode/assets/main.scss
Normal file
84
tvmode/assets/main.scss
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
@tailwind base;
|
||||||
|
@tailwind components;
|
||||||
|
@tailwind utilities;
|
||||||
|
|
||||||
|
html,
|
||||||
|
body {
|
||||||
|
-ms-overflow-style: none; /* IE and Edge /
|
||||||
|
scrollbar-width: none; / Firefox */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hide scrollbar for Chrome, Safari and Opera */
|
||||||
|
html::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
$motiva: (
|
||||||
|
("MotivaSansThin.ttf", "ttf", 100, normal),
|
||||||
|
("MotivaSansLight.woff.ttf", "woff", 300, normal),
|
||||||
|
("MotivaSansRegular.woff.ttf", "woff", 400, normal),
|
||||||
|
("MotivaSansMedium.woff.ttf", "woff", 500, normal),
|
||||||
|
("MotivaSansBold.woff.ttf", "woff", 600, normal),
|
||||||
|
("MotivaSansExtraBold.ttf", "woff", 700, normal),
|
||||||
|
("MotivaSansBlack.woff.ttf", "woff", 900, normal)
|
||||||
|
);
|
||||||
|
|
||||||
|
$helvetica: (
|
||||||
|
("Helvetica.woff", "woff", 400, normal),
|
||||||
|
("Helvetica-Oblique.woff", "woff", 400, italic),
|
||||||
|
("Helvetica-Bold.woff", "woff", 600, normal),
|
||||||
|
("Helvetica-BoldOblique.woff", "woff", 600, italic),
|
||||||
|
("helvetica-light-587ebe5a59211.woff2", "woff2", 300, normal)
|
||||||
|
);
|
||||||
|
|
||||||
|
@each $file, $format, $weight, $style in $motiva {
|
||||||
|
@font-face {
|
||||||
|
font-family: "Motiva Sans";
|
||||||
|
src: url("/fonts/motiva/#{$file}") format($format);
|
||||||
|
font-weight: $weight;
|
||||||
|
font-style: $style;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@each $file, $format, $weight, $style in $helvetica {
|
||||||
|
@font-face {
|
||||||
|
font-family: "Helvetica";
|
||||||
|
src: url("/fonts/helvetica/#{$file}") format($format);
|
||||||
|
font-weight: $weight;
|
||||||
|
font-style: $style;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "Inter";
|
||||||
|
src: url("/fonts/inter/InterVariable.ttf");
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "Inter";
|
||||||
|
src: url("/fonts/inter/InterVariable-Italic.ttf");
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Scrollbar CSS ===== */
|
||||||
|
/* Firefox */
|
||||||
|
* {
|
||||||
|
scrollbar-width: 4px;
|
||||||
|
scrollbar-color: #52525b #00000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Chrome, Edge, and Safari */
|
||||||
|
*::-webkit-scrollbar {
|
||||||
|
width: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
*::-webkit-scrollbar-track {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
*::-webkit-scrollbar-thumb {
|
||||||
|
background-color: #52525b;
|
||||||
|
border-radius: 10px;
|
||||||
|
border: 3px solid #52525b;
|
||||||
|
}
|
||||||
BIN
tvmode/assets/wallpaper.jpg
Normal file
BIN
tvmode/assets/wallpaper.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.5 MiB |
71
tvmode/components/Sidebar.vue
Normal file
71
tvmode/components/Sidebar.vue
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<template>
|
||||||
|
<div class="bg-zinc-950 flex flex-col items-center pl-5 px-10 py-8">
|
||||||
|
<div class="flex flex-col items-center gap-y-10">
|
||||||
|
<Wordmark class="h-8 mb-0.5" />
|
||||||
|
<ol class="flex flex-col gap-y-2">
|
||||||
|
<NuxtLink
|
||||||
|
v-for="(nav, navIdx) in navigation"
|
||||||
|
:class="[
|
||||||
|
'transition rounded focus:ring-2 ring-blue-600 px-2 uppercase font-display font-semibold text-xl',
|
||||||
|
navIdx === currentNavigation
|
||||||
|
? 'text-zinc-100'
|
||||||
|
: 'text-zinc-400 hover:text-zinc-200',
|
||||||
|
]"
|
||||||
|
:href="nav.route"
|
||||||
|
>
|
||||||
|
{{ nav.label }}
|
||||||
|
</NuxtLink>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { BellIcon, UserGroupIcon } from "@heroicons/vue/16/solid";
|
||||||
|
import { AppStatus, type NavigationItem, type QuickActionNav } from "../types";
|
||||||
|
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||||
|
|
||||||
|
const window = getCurrentWindow();
|
||||||
|
const state = useAppState();
|
||||||
|
|
||||||
|
const navigation: Array<NavigationItem> = [
|
||||||
|
{
|
||||||
|
prefix: "/store",
|
||||||
|
route: "/store",
|
||||||
|
label: "Store",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prefix: "/library",
|
||||||
|
route: "/library",
|
||||||
|
label: "Library",
|
||||||
|
},
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
prefix: "/community",
|
||||||
|
route: "/community",
|
||||||
|
label: "Community",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prefix: "/news",
|
||||||
|
route: "/news",
|
||||||
|
label: "News",
|
||||||
|
},
|
||||||
|
*/
|
||||||
|
];
|
||||||
|
|
||||||
|
const { currentNavigation } = useCurrentNavigationIndex(navigation);
|
||||||
|
|
||||||
|
const quickActions: Array<QuickActionNav> = [
|
||||||
|
{
|
||||||
|
icon: UserGroupIcon,
|
||||||
|
action: async () => {},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: BellIcon,
|
||||||
|
action: async () => {},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const queue = useQueueState();
|
||||||
|
const currentQueueObject = computed(() => queue.value.queue.at(0));
|
||||||
|
</script>
|
||||||
@ -1,3 +0,0 @@
|
|||||||
class TVModeNavigator {
|
|
||||||
|
|
||||||
};
|
|
||||||
@ -4,11 +4,6 @@ const NAVIGATE_INTERACT_ID = "tvnav-iid";
|
|||||||
const Directions = ["left", "right", "up", "down"] as const;
|
const Directions = ["left", "right", "up", "down"] as const;
|
||||||
type Direction = (typeof Directions)[number];
|
type Direction = (typeof Directions)[number];
|
||||||
|
|
||||||
const NAVIGATE_LEFT_ID = "tvnav-left";
|
|
||||||
const NAVIGATE_RIGHT_ID = "tvnav-right";
|
|
||||||
const NAVIGATE_UP_ID = "tvnav-up";
|
|
||||||
const NAVIGATE_DOWN_ID = "tvnav-down";
|
|
||||||
|
|
||||||
interface NavigationJump {
|
interface NavigationJump {
|
||||||
distance: number;
|
distance: number;
|
||||||
id: string;
|
id: string;
|
||||||
@ -17,12 +12,9 @@ interface NavigationJump {
|
|||||||
type Position = [number, number, number, number];
|
type Position = [number, number, number, number];
|
||||||
|
|
||||||
class TVModeNavigator {
|
class TVModeNavigator {
|
||||||
private rootNode: Ref<HTMLElement | undefined>;
|
private navigationNodes: Map<string, HTMLElement> = new Map();
|
||||||
private navigationNodes: Map<string, Array<HTMLElement>> = new Map();
|
|
||||||
|
|
||||||
constructor(rootNode: Ref<HTMLElement | undefined>) {
|
|
||||||
this.rootNode = rootNode;
|
|
||||||
|
|
||||||
|
constructor() {
|
||||||
const thisRef = this;
|
const thisRef = this;
|
||||||
const observer = new MutationObserver((v, k) => {
|
const observer = new MutationObserver((v, k) => {
|
||||||
this.onMutation(thisRef, v, k);
|
this.onMutation(thisRef, v, k);
|
||||||
@ -57,21 +49,41 @@ class TVModeNavigator {
|
|||||||
return a.map((v, i) => v === b[i]).every((v) => v);
|
return a.map((v, i) => v === b[i]).every((v) => v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getUniqueNavNodes() {
|
||||||
|
const hasSeen = new Map<string, boolean>();
|
||||||
|
return this.navigationNodes
|
||||||
|
.values()
|
||||||
|
.filter((v) => {
|
||||||
|
const id = this.getInteractionId(v);
|
||||||
|
if (hasSeen.get(id)) return false;
|
||||||
|
hasSeen.set(id, true);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private findElementWithPredicate(
|
private findElementWithPredicate(
|
||||||
distanceCalculator: (current: Position, target: Position) => number,
|
|
||||||
check: (current: Position, target: Position) => boolean
|
check: (current: Position, target: Position) => boolean
|
||||||
) {
|
) {
|
||||||
const current = this.getCurrentPosition();
|
const current = this.getCurrentPosition();
|
||||||
// We want things in the x direction, with a limit on the y
|
// We want things in the x direction, with a limit on the y
|
||||||
let distance = Math.max(window.innerWidth, window.innerHeight);
|
let distance = Math.max(window.innerWidth, window.innerHeight);
|
||||||
let element = null;
|
let element = null;
|
||||||
for (const newElement of this.navigationNodes.values().toArray().flat()) {
|
const nodes = this.getUniqueNavNodes();
|
||||||
|
for (const newElement of nodes) {
|
||||||
const target = this.getCurrentPosition(newElement);
|
const target = this.getCurrentPosition(newElement);
|
||||||
if(this.isSamePosition(current, target)) continue;
|
if (this.isSamePosition(current, target)) continue;
|
||||||
const newDistance = distanceCalculator(current, target);
|
const newDistance = Math.sqrt(
|
||||||
|
Math.pow(current[0] - target[0], 2) +
|
||||||
|
Math.pow(current[2] - target[2], 2)
|
||||||
|
);
|
||||||
// If we're the wrong way, or further than the current option
|
// If we're the wrong way, or further than the current option
|
||||||
if (newDistance < 0 || newDistance > distance) continue;
|
if (newDistance < 0 || newDistance > distance) {
|
||||||
if (check(current, target)) continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!check(current, target)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
distance = newDistance;
|
distance = newDistance;
|
||||||
element = newElement;
|
element = newElement;
|
||||||
}
|
}
|
||||||
@ -79,12 +91,10 @@ class TVModeNavigator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
moveUp() {
|
moveUp() {
|
||||||
const leeway = 20; // 20px
|
const leeway = 100; // 20px
|
||||||
const element = this.findElementWithPredicate(
|
const element = this.findElementWithPredicate(
|
||||||
([xleft, xright, ytop, ybottom], [eleft, eright, etop, ebottom]) =>
|
([xleft, xright, ytop, ybottom], [eleft, eright, etop, ebottom]) =>
|
||||||
ytop - ebottom,
|
xleft - leeway < eright && xright + leeway > eleft && ytop >= ebottom
|
||||||
([xleft, xright, ytop, ybottom], [eleft, eright, etop, ebottom]) =>
|
|
||||||
xleft - leeway > eright && xright + leeway < eleft
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (element) {
|
if (element) {
|
||||||
@ -96,9 +106,7 @@ class TVModeNavigator {
|
|||||||
const leeway = 20; // 20px
|
const leeway = 20; // 20px
|
||||||
const element = this.findElementWithPredicate(
|
const element = this.findElementWithPredicate(
|
||||||
([xleft, xright, ytop, ybottom], [eleft, eright, etop, ebottom]) =>
|
([xleft, xright, ytop, ybottom], [eleft, eright, etop, ebottom]) =>
|
||||||
etop - ybottom,
|
xleft - leeway < eright && xright + leeway > eleft && ytop <= ebottom
|
||||||
([xleft, xright, ytop, ybottom], [eleft, eright, etop, ebottom]) =>
|
|
||||||
xleft - leeway > eright && xright + leeway < eleft
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (element) {
|
if (element) {
|
||||||
@ -107,12 +115,10 @@ class TVModeNavigator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
moveRight() {
|
moveRight() {
|
||||||
const leeway = 20; // 20px
|
const leeway = 0; // 20px
|
||||||
const element = this.findElementWithPredicate(
|
const element = this.findElementWithPredicate(
|
||||||
([xleft, xright, ytop, ybottom], [eleft, eright, etop, ebottom]) =>
|
([xleft, xright, ytop, ybottom], [eleft, eright, etop, ebottom]) =>
|
||||||
eleft - xright,
|
ytop - leeway < ebottom && ybottom + leeway > etop && xright <= eleft
|
||||||
([xleft, xright, ytop, ybottom], [eleft, eright, etop, ebottom]) =>
|
|
||||||
etop - leeway > ytop && ebottom + leeway < etop
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (element) {
|
if (element) {
|
||||||
@ -124,9 +130,7 @@ class TVModeNavigator {
|
|||||||
const leeway = 20; // 20px
|
const leeway = 20; // 20px
|
||||||
const element = this.findElementWithPredicate(
|
const element = this.findElementWithPredicate(
|
||||||
([xleft, xright, ytop, ybottom], [eleft, eright, etop, ebottom]) =>
|
([xleft, xright, ytop, ybottom], [eleft, eright, etop, ebottom]) =>
|
||||||
xleft - eright,
|
ytop - leeway < ebottom && ybottom + leeway > etop && xleft >= eright
|
||||||
([xleft, xright, ytop, ybottom], [eleft, eright, etop, ebottom]) =>
|
|
||||||
etop - leeway > ytop && ebottom + leeway < etop
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (element) {
|
if (element) {
|
||||||
@ -146,7 +150,7 @@ class TVModeNavigator {
|
|||||||
elements.push(child);
|
elements.push(child);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(child instanceof HTMLInputElement) {
|
if (child instanceof HTMLInputElement) {
|
||||||
elements.push(child);
|
elements.push(child);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -167,66 +171,23 @@ class TVModeNavigator {
|
|||||||
return newId;
|
return newId;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getNavJumpKey(direction: Direction) {
|
|
||||||
switch (direction) {
|
|
||||||
case "down":
|
|
||||||
return NAVIGATE_DOWN_ID;
|
|
||||||
case "left":
|
|
||||||
return NAVIGATE_LEFT_ID;
|
|
||||||
case "right":
|
|
||||||
return NAVIGATE_RIGHT_ID;
|
|
||||||
case "up":
|
|
||||||
return NAVIGATE_UP_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw "Invalid direction";
|
|
||||||
}
|
|
||||||
|
|
||||||
getNavJump(
|
|
||||||
element: Element,
|
|
||||||
direction: Direction
|
|
||||||
): NavigationJump | undefined {
|
|
||||||
const key = this.getNavJumpKey(direction);
|
|
||||||
const value = element.getAttribute(key);
|
|
||||||
if (!value) return undefined;
|
|
||||||
const [id, distance] = value.split("/");
|
|
||||||
return {
|
|
||||||
distance: parseFloat(distance),
|
|
||||||
id,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
onMutation(
|
onMutation(
|
||||||
self: TVModeNavigator,
|
self: TVModeNavigator,
|
||||||
mutationlist: Array<MutationRecord>,
|
mutationlist: Array<MutationRecord>,
|
||||||
observer: unknown
|
observer: unknown
|
||||||
) {
|
) {
|
||||||
for (const mutation of mutationlist) {
|
for (const mutation of mutationlist) {
|
||||||
for (const node of mutation.removedNodes) {
|
|
||||||
if (node.nodeType !== Node.ELEMENT_NODE) continue;
|
|
||||||
const el = node as Element;
|
|
||||||
const id = el.getAttribute(NAVIGATE_MODIFIED_PROP);
|
|
||||||
if (id) {
|
|
||||||
self.navigationNodes.delete(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const node of mutation.addedNodes) {
|
for (const node of mutation.addedNodes) {
|
||||||
if (!node) continue;
|
if (!node) continue;
|
||||||
if (node.nodeType !== Node.ELEMENT_NODE) continue;
|
if (node.nodeType !== Node.ELEMENT_NODE) continue;
|
||||||
const el = node as Element;
|
const el = node as Element;
|
||||||
|
|
||||||
const existingId = el.getAttribute(NAVIGATE_MODIFIED_PROP);
|
|
||||||
if (existingId) {
|
|
||||||
self.navigationNodes.delete(existingId);
|
|
||||||
}
|
|
||||||
|
|
||||||
const interactiveNodes = self.recursivelyFindInteractable(el);
|
const interactiveNodes = self.recursivelyFindInteractable(el);
|
||||||
|
|
||||||
const id = crypto.randomUUID();
|
for (const v of interactiveNodes) {
|
||||||
el.setAttribute(NAVIGATE_MODIFIED_PROP, id);
|
const id = self.getInteractionId(v);
|
||||||
|
self.navigationNodes.set(id, v);
|
||||||
self.navigationNodes.set(id, interactiveNodes);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,5 +203,4 @@ class TVModeNavigator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const createTVNavigator = (rootNode: Ref<HTMLElement | undefined>) =>
|
export const createTVNavigator = () => new TVModeNavigator();
|
||||||
new TVModeNavigator(rootNode);
|
|
||||||
12
tvmode/layouts/default.vue
Normal file
12
tvmode/layouts/default.vue
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<template>
|
||||||
|
<div tvnav-id="mainbody" class="flex flex-row bg-zinc-900 overflow-hidden h-screen">
|
||||||
|
<Sidebar class="select-none" />
|
||||||
|
<div class="relative grow overflow-y-auto">
|
||||||
|
<slot />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
const queueState = useQueueState();
|
||||||
|
</script>
|
||||||
@ -1,5 +1,25 @@
|
|||||||
// https://nuxt.com/docs/api/configuration/nuxt-config
|
// https://nuxt.com/docs/api/configuration/nuxt-config
|
||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
compatibilityDate: '2025-07-15',
|
compatibilityDate: "2024-04-03",
|
||||||
devtools: { enabled: true }
|
|
||||||
})
|
postcss: {
|
||||||
|
plugins: {
|
||||||
|
tailwindcss: {},
|
||||||
|
autoprefixer: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
ssr: false,
|
||||||
|
|
||||||
|
extends: ["../shared", "../libs/drop-base"],
|
||||||
|
|
||||||
|
app: {
|
||||||
|
baseURL: "/tvmode",
|
||||||
|
},
|
||||||
|
|
||||||
|
devtools: {
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|||||||
@ -10,8 +10,15 @@
|
|||||||
"postinstall": "nuxt prepare"
|
"postinstall": "nuxt prepare"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"nuxt": "^4.1.2",
|
"@headlessui/vue": "^1.7.23",
|
||||||
"vue": "^3.5.21",
|
"@heroicons/vue": "^2.1.5",
|
||||||
"vue-router": "^4.5.1"
|
"@nuxtjs/tailwindcss": "^6.12.2",
|
||||||
|
"@tauri-apps/api": "^2.7.0",
|
||||||
|
"markdown-it": "^14.1.0",
|
||||||
|
"micromark": "^4.0.1",
|
||||||
|
"nuxt": "^3.16.0",
|
||||||
|
"sass-embedded": "^1.93.1",
|
||||||
|
"scss": "^0.2.4",
|
||||||
|
"vue-router": "latest"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1
tvmode/pages/index.vue
Normal file
1
tvmode/pages/index.vue
Normal file
@ -0,0 +1 @@
|
|||||||
|
<template></template>
|
||||||
28
tvmode/pages/library.vue
Normal file
28
tvmode/pages/library.vue
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<template>
|
||||||
|
<div class="grid grid-cols-4 gap-4 p-8">
|
||||||
|
<NuxtLink
|
||||||
|
class="group transition-all duration-300 overflow-hidden bg-zinc-950 p-2 rounded-xl relative focus:scale-105"
|
||||||
|
v-for="game in newGames"
|
||||||
|
:key="game.id"
|
||||||
|
:to="`/library/${game.id}`"
|
||||||
|
>
|
||||||
|
<div class="h-full z-10 relative bg-zinc-800/40 p-4 rounded-xl">
|
||||||
|
<h1 class="text-xl text-zinc-100 font-bold">{{ game.mName }}</h1>
|
||||||
|
<p class="text-xs text-zinc-400">{{ game.mShortDescription }}</p>
|
||||||
|
</div>
|
||||||
|
<img
|
||||||
|
class="transition group-focus:blur absolute inset-0 z-0"
|
||||||
|
:src="useObject(game.mBannerObjectId)"
|
||||||
|
/>
|
||||||
|
</NuxtLink>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { invoke } from "@tauri-apps/api/core";
|
||||||
|
import type { Game } from "~/types";
|
||||||
|
|
||||||
|
const newGames = await invoke<Game[]>("fetch_library", {
|
||||||
|
hardRefresh: true,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
1
tvmode/pages/store.vue
Normal file
1
tvmode/pages/store.vue
Normal file
@ -0,0 +1 @@
|
|||||||
|
<template></template>
|
||||||
22
tvmode/tailwind.config.js
Normal file
22
tvmode/tailwind.config.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/** @type {import('tailwindcss').Config} */
|
||||||
|
export default {
|
||||||
|
content: [
|
||||||
|
"./components/**/*.{js,vue,ts}",
|
||||||
|
"./layouts/**/*.vue",
|
||||||
|
"./pages/**/*.vue",
|
||||||
|
"./plugins/**/*.{js,ts}",
|
||||||
|
"./app.vue",
|
||||||
|
"./error.vue",
|
||||||
|
"../shared/components/**/*.vue",
|
||||||
|
"../shared/error.vue",
|
||||||
|
],
|
||||||
|
theme: {
|
||||||
|
extend: {
|
||||||
|
fontFamily: {
|
||||||
|
sans: ["Inter"],
|
||||||
|
display: ["Motiva Sans"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
plugins: [],
|
||||||
|
};
|
||||||
@ -1,18 +1,5 @@
|
|||||||
{
|
{
|
||||||
// https://nuxt.com/docs/guide/concepts/typescript
|
// https://nuxt.com/docs/guide/concepts/typescript
|
||||||
"files": [],
|
"extends": "./.nuxt/tsconfig.json",
|
||||||
"references": [
|
"exclude": ["src-tauri/**/*"]
|
||||||
{
|
|
||||||
"path": "./.nuxt/tsconfig.app.json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "./.nuxt/tsconfig.server.json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "./.nuxt/tsconfig.shared.json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "./.nuxt/tsconfig.node.json"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|||||||
96
tvmode/types.ts
Normal file
96
tvmode/types.ts
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
import type { Component } from "vue";
|
||||||
|
|
||||||
|
export type NavigationItem = {
|
||||||
|
prefix: string;
|
||||||
|
route: string;
|
||||||
|
label: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type QuickActionNav = {
|
||||||
|
icon: Component;
|
||||||
|
notifications?: number;
|
||||||
|
action: () => Promise<void>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type User = {
|
||||||
|
id: string;
|
||||||
|
username: string;
|
||||||
|
admin: boolean;
|
||||||
|
displayName: string;
|
||||||
|
profilePictureObjectId: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type AppState = {
|
||||||
|
status: AppStatus;
|
||||||
|
user?: User;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Game = {
|
||||||
|
id: string;
|
||||||
|
mName: string;
|
||||||
|
mShortDescription: string;
|
||||||
|
mDescription: string;
|
||||||
|
mIconObjectId: string;
|
||||||
|
mBannerObjectId: string;
|
||||||
|
mCoverObjectId: string;
|
||||||
|
mImageLibraryObjectIds: string[];
|
||||||
|
mImageCarouselObjectIds: string[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Collection = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
isDefault: boolean;
|
||||||
|
entries: Array<{ gameId: string; game: Game }>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type GameVersion = {
|
||||||
|
launchCommandTemplate: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export enum AppStatus {
|
||||||
|
NotConfigured = "NotConfigured",
|
||||||
|
Offline = "Offline",
|
||||||
|
SignedOut = "SignedOut",
|
||||||
|
SignedIn = "SignedIn",
|
||||||
|
SignedInNeedsReauth = "SignedInNeedsReauth",
|
||||||
|
ServerUnavailable = "ServerUnavailable",
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum GameStatusEnum {
|
||||||
|
Remote = "Remote",
|
||||||
|
Queued = "Queued",
|
||||||
|
Downloading = "Downloading",
|
||||||
|
Validating = "Validating",
|
||||||
|
Installed = "Installed",
|
||||||
|
Updating = "Updating",
|
||||||
|
Uninstalling = "Uninstalling",
|
||||||
|
SetupRequired = "SetupRequired",
|
||||||
|
Running = "Running",
|
||||||
|
PartiallyInstalled = "PartiallyInstalled",
|
||||||
|
}
|
||||||
|
|
||||||
|
export type GameStatus = {
|
||||||
|
type: GameStatusEnum;
|
||||||
|
version_name?: string;
|
||||||
|
install_dir?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export enum DownloadableType {
|
||||||
|
Game = "Game",
|
||||||
|
Tool = "Tool",
|
||||||
|
DLC = "DLC",
|
||||||
|
Mod = "Mod",
|
||||||
|
}
|
||||||
|
|
||||||
|
export type DownloadableMetadata = {
|
||||||
|
id: string;
|
||||||
|
version: string;
|
||||||
|
downloadType: DownloadableType;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Settings = {
|
||||||
|
autostart: boolean;
|
||||||
|
maxDownloadThreads: number;
|
||||||
|
forceOffline: boolean;
|
||||||
|
};
|
||||||
1452
tvmode/yarn.lock
1452
tvmode/yarn.lock
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user