mirror of
https://github.com/BillyOutlast/drop.git
synced 2026-02-04 08:41:17 +01:00
feat: add yarn typecheck and fix all types
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<ModalTemplate v-model="open">
|
||||
<ModalTemplate v-model="!!open">
|
||||
<template #default>
|
||||
<div>
|
||||
<DialogTitle as="h3" class="text-lg font-medium leading-6 text-white">
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
<template>
|
||||
<div
|
||||
v-if="user"
|
||||
class="flex grow flex-col gap-y-5 overflow-y-auto bg-zinc-900 px-6 pb-4 ring-1 ring-white/10"
|
||||
>
|
||||
<div class="flex h-16 shrink-0 items-center">
|
||||
<Wordmark />
|
||||
</div>
|
||||
|
||||
<nav class="flex flex-1 flex-col">
|
||||
<ul role="list" class="flex flex-1 flex-col gap-y-7">
|
||||
<li>
|
||||
<ul role="list" class="-mx-2 space-y-1">
|
||||
<DocsSidebarNavItem
|
||||
v-for="item in unwrappedNavigation ?? navigation"
|
||||
:key="item.name"
|
||||
:nav="item"
|
||||
/>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="mt-auto flex items-center">
|
||||
<div class="inline-flex items-center w-full text-zinc-300">
|
||||
<img
|
||||
:src="useObject(user.profilePicture)"
|
||||
class="w-5 h-5 rounded-sm"
|
||||
/>
|
||||
<span class="ml-3 text-sm font-bold">{{
|
||||
user.displayName
|
||||
}}</span>
|
||||
</div>
|
||||
<NuxtLink
|
||||
href="/"
|
||||
class="ml-auto rounded bg-blue-600 px-2 py-1 text-sm font-semibold text-white shadow-sm hover:bg-blue-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600"
|
||||
>
|
||||
← Home
|
||||
</NuxtLink>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { fetchContentNavigation, useObject, useUser } from "#imports";
|
||||
|
||||
const user = useUser();
|
||||
|
||||
const navigation = await fetchContentNavigation();
|
||||
const unwrappedNavigation = navigation[0]?.children;
|
||||
</script>
|
||||
@@ -1,30 +0,0 @@
|
||||
<template>
|
||||
<NuxtLink
|
||||
:href="props.nav._path"
|
||||
:class="[
|
||||
current
|
||||
? 'text-zinc-100'
|
||||
: 'text-zinc-400 hover:text-zinc-100 hover:bg-zinc-900',
|
||||
' group flex gap-x-3 rounded-md px-2 text-sm font-semibold leading-6',
|
||||
]"
|
||||
>
|
||||
{{ props.nav.title }}
|
||||
</NuxtLink>
|
||||
<ul class="pl-3 flex flex-col" v-if="children">
|
||||
<li v-for="child in children" class="inline-flex items-center">
|
||||
<ChevronDownIcon class="w-4 h-4 text-zinc-600 rotate-45" />
|
||||
<DocsSidebarNavItem :nav="child" :key="child._path" />
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ChevronDownIcon } from "@heroicons/vue/24/solid";
|
||||
|
||||
type NavItem = { title: string; _path: string; children?: NavItem[] };
|
||||
const props = defineProps<{ nav: NavItem }>();
|
||||
const children = props.nav.children?.filter((e) => e._path != props.nav._path);
|
||||
|
||||
const route = useRoute();
|
||||
const current = computed(() => route.path.trim() == props.nav._path.trim());
|
||||
</script>
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<Listbox as="div" v-model="model">
|
||||
<Listbox as="div" v-model="typedModel">
|
||||
<ListboxLabel class="block text-sm font-medium leading-6 text-zinc-100"
|
||||
><slot
|
||||
/></ListboxLabel>
|
||||
@@ -74,7 +74,6 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { IconsLinuxLogo, IconsMacLogo, IconsWindowsLogo } from "#components";
|
||||
import {
|
||||
Listbox,
|
||||
ListboxButton,
|
||||
@@ -83,9 +82,18 @@ import {
|
||||
ListboxOptions,
|
||||
} from "@headlessui/vue";
|
||||
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid";
|
||||
import type { Component } from "vue";
|
||||
|
||||
const model = defineModel<PlatformClient>();
|
||||
const model = defineModel<PlatformClient | undefined>();
|
||||
|
||||
const typedModel = computed<PlatformClient | null>({
|
||||
get() {
|
||||
return model.value || null;
|
||||
},
|
||||
set(v) {
|
||||
if (v === null) return (model.value = undefined);
|
||||
model.value = v;
|
||||
},
|
||||
});
|
||||
|
||||
const values = Object.fromEntries(Object.entries(PlatformClient));
|
||||
</script>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<TransitionRoot as="template" :show="open">
|
||||
<TransitionRoot as="template" :show="!!open">
|
||||
<Dialog class="relative z-50" @close="open = false">
|
||||
<TransitionChild
|
||||
as="template"
|
||||
|
||||
@@ -45,6 +45,16 @@ export default defineNuxtConfig({
|
||||
compressPublicAssets: true,
|
||||
},
|
||||
|
||||
typescript: {
|
||||
tsConfig: {
|
||||
compilerOptions: {
|
||||
verbatimModuleSyntax: false,
|
||||
skipDefaultLibCheck: true,
|
||||
skipLibCheck: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
extends: ["./drop-base"],
|
||||
|
||||
// Module config from here down
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
"dev": "nuxt dev",
|
||||
"generate": "nuxt generate",
|
||||
"preview": "nuxt preview",
|
||||
"postinstall": "nuxt prepare"
|
||||
"postinstall": "nuxt prepare",
|
||||
"typecheck": "nuxi typecheck"
|
||||
},
|
||||
"dependencies": {
|
||||
"@drop-oss/droplet": "^0.7.2",
|
||||
|
||||
@@ -27,7 +27,7 @@ export default defineEventHandler(async (h3) => {
|
||||
take: parseInt(query.limit as string),
|
||||
skip: parseInt(query.skip as string),
|
||||
orderBy: orderBy,
|
||||
tags: tags?.map((e) => e.toString()),
|
||||
...(tags && { tags: tags.map((e) => e.toString()) }),
|
||||
search: query.search as string,
|
||||
};
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ export default defineEventHandler(async (h3) => {
|
||||
|
||||
tags: tags,
|
||||
|
||||
image: imageId,
|
||||
...(imageId && { image: imageId }),
|
||||
authorId: "system",
|
||||
});
|
||||
|
||||
|
||||
@@ -23,18 +23,9 @@ export default defineClientEventHandler(async (h3, {}) => {
|
||||
const mappedVersions = versions
|
||||
.map((version) => {
|
||||
if (!version.dropletManifest) return undefined;
|
||||
const manifest = JSON.parse(
|
||||
version.dropletManifest.toString()
|
||||
) as DropManifest;
|
||||
|
||||
/*
|
||||
TODO: size estimates
|
||||
They are a little complicated because of delta versions
|
||||
Manifests need to be generated with the manifest generator and then
|
||||
added up. I'm a little busy right now to implement this, though.
|
||||
*/
|
||||
|
||||
|
||||
const newVersion = { ...version, dropletManifest: undefined };
|
||||
// @ts-expect-error
|
||||
delete newVersion.dropletManifest;
|
||||
return {
|
||||
...newVersion,
|
||||
|
||||
@@ -23,18 +23,8 @@ export default defineClientEventHandler(async (h3, {}) => {
|
||||
const mappedVersions = versions
|
||||
.map((version) => {
|
||||
if (!version.dropletManifest) return undefined;
|
||||
const manifest = JSON.parse(
|
||||
version.dropletManifest.toString()
|
||||
) as DropManifest;
|
||||
|
||||
/*
|
||||
TODO: size estimates
|
||||
They are a little complicated because of delta versions
|
||||
Manifests need to be generated with the manifest generator and then
|
||||
added up. I'm a little busy right now to implement this, though.
|
||||
*/
|
||||
|
||||
const newVersion = { ...version, dropletManifest: undefined };
|
||||
// @ts-expect-error
|
||||
delete newVersion.dropletManifest;
|
||||
return {
|
||||
...newVersion,
|
||||
|
||||
@@ -20,7 +20,7 @@ export default defineClientEventHandler(async (h3) => {
|
||||
take: parseInt(query.limit as string),
|
||||
skip: parseInt(query.skip as string),
|
||||
orderBy: orderBy,
|
||||
tags: tags?.map((e) => e.toString()),
|
||||
...(tags && { tags: tags.map((e) => e.toString()) }),
|
||||
search: query.search as string,
|
||||
};
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ export default defineEventHandler(async (h3) => {
|
||||
take: parseInt(query.limit as string),
|
||||
skip: parseInt(query.skip as string),
|
||||
orderBy: orderBy,
|
||||
tags: tags?.map((e) => e.toString()),
|
||||
...(tags && { tags: tags.map((e) => e.toString()) }),
|
||||
search: query.search as string,
|
||||
};
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class NewsManager {
|
||||
})),
|
||||
},
|
||||
|
||||
image: data.image,
|
||||
...(data.image && { image: data.image }),
|
||||
author: {
|
||||
connect: {
|
||||
id: data.authorId,
|
||||
|
||||
@@ -67,14 +67,14 @@ export class PriorityListIndexed<T> extends PriorityList<T> {
|
||||
return index as string;
|
||||
}
|
||||
|
||||
push(item: T, priority?: number): void {
|
||||
override push(item: T, priority?: number): void {
|
||||
const index = this.getIndex(item);
|
||||
this.indexMap[index] = item;
|
||||
|
||||
super.push(item, priority);
|
||||
}
|
||||
|
||||
pop(position?: number): PriorityTagged<T> {
|
||||
override pop(position?: number): PriorityTagged<T> {
|
||||
const value = super.pop(position);
|
||||
|
||||
const index = this.getIndex(value.object);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import sessionHandler from "../internal/session";
|
||||
|
||||
export default defineEventHandler(async (h3) => {
|
||||
await sessionHandler.clearSession(h3);
|
||||
await sessionHandler.signout(h3);
|
||||
|
||||
return sendRedirect(h3, "/auth/signin");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user