mirror of
https://iceshrimp.dev/Crimekillz/jointrashposs.git
synced 2024-11-21 16:33:48 +01:00
(add) docs: iroiro
This commit is contained in:
parent
a73c7218cc
commit
91e4ce4b2a
@ -39,3 +39,20 @@ export function isLocalPath(link: string, base?: string): boolean {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export const findDeepObject = (obj: Record<string, any>, condition: (v: any) => boolean): Record<string, any> | null => {
|
||||
if (condition(obj)) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
if (obj?.children && obj.children.length > 0) {
|
||||
for (let i = 0; i < obj.children.length; i++) {
|
||||
const result = findDeepObject(obj.children[i], condition);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
22
components/content/ApiPermissions.vue
Normal file
22
components/content/ApiPermissions.vue
Normal file
@ -0,0 +1,22 @@
|
||||
<template>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Permisson</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="permission in permissions">
|
||||
<td><code>{{ permission }}</code></td>
|
||||
<td>{{ $t(`_api._permissions.${permission}`) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { permissions } from 'misskey-js';
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
@ -29,14 +29,16 @@ const { locale } = useI18n();
|
||||
const route = useRoute();
|
||||
const slugs = (route.params.slug as string[]).filter((v) => v !== '');
|
||||
|
||||
withDefaults(defineProps<{
|
||||
const props = withDefaults(defineProps<{
|
||||
ignoreDirBasedNav?: boolean;
|
||||
isDir?: boolean;
|
||||
}>(), {
|
||||
ignoreDirBasedNav: false,
|
||||
isDir: false
|
||||
});
|
||||
|
||||
const currentPath = `/${locale.value}/docs/${slugs.join('/')}`;
|
||||
const currentDirectory = `/${locale.value}/docs/${slugs.slice(0, -1).join('/')}`;
|
||||
const currentDirectory = props.isDir ? `/${locale.value}/docs/${slugs.join('/')}` : `/${locale.value}/docs/${slugs.slice(0, -1).join('/')}`;
|
||||
|
||||
const [prev, next] = await queryContent().only(['_path', 'title']).where({ _path: { $contains: 'docs' }, _partial: false }).findSurround(currentPath);
|
||||
</script>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="relative container mx-auto max-w-screen-xl p-6 lg:py-0 grid docs-root pb-12">
|
||||
<div class="lg:hidden sticky top-16 -mx-6 -mt-6 bg-white px-6 bg-opacity-60 backdrop-blur-lg z-[9890] border-b text-sm">
|
||||
<div v-if="data?.body" class="lg:hidden sticky top-16 -mx-6 -mt-6 bg-white px-6 bg-opacity-60 backdrop-blur-lg z-[9890] border-b text-sm">
|
||||
<details :open="openState">
|
||||
<summary class="py-4 cursor-pointer">{{ $t('_docs._toc.title') }}</summary>
|
||||
<div class="pb-4 overflow-y-auto">
|
||||
@ -10,18 +10,26 @@
|
||||
</div>
|
||||
<div class="hidden lg:block">
|
||||
<div class="sticky top-16 h-[calc(100vh-4rem)] overflow-y-scroll border-r border-slate-200 dark:border-slate-700 py-6 pr-6">
|
||||
<DocsAsideTree :links="navigation" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="pt-6 lg:p-6 w-full overflow-x-hidden">
|
||||
<ContentRenderer :value="data" class="markdown-body w-full mb-6">
|
||||
<template v-if="data?.body">
|
||||
<ContentRenderer v-if="data.body.children.length > 0" :value="data" class="markdown-body w-full mb-6">
|
||||
</ContentRenderer>
|
||||
<DocsPrevNext :ignore-dir-based-nav="data?.ignoreDirBasedNav ?? false" />
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="markdown-body">
|
||||
<h1>{{ data?.title ?? data?._dir?.title }}</h1>
|
||||
<MkIndex :is-dir="data?._file?.endsWith('index.md') || (!data?._file)" />
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class="hidden lg:block text-sm">
|
||||
<div class="sticky top-16 h-[calc(100vh-4rem)] overflow-y-auto py-6 pl-6">
|
||||
<h3 class="font-bold mb-6">{{ $t('_docs._toc.title') }}</h3>
|
||||
<DocsTocLinks :links="data?.body.toc.links" />
|
||||
<DocsTocLinks v-if="data?.body" :links="data?.body.toc.links" class="break-words" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -49,9 +57,10 @@ const slugs = (route.params.slug as string[]).filter((v) => v !== '');
|
||||
const { data } = await useAsyncData(`blog-${locale.value}-${slugs.join('-')}`, () => queryContent(`/${locale.value}/docs/${slugs.join('/')}`).findOne());
|
||||
const { navigation } = await useAsyncData('navigation', () => fetchContentNavigation());
|
||||
|
||||
/*
|
||||
if (!data.value) {
|
||||
throw createError({ statusCode: 404, statusMessage: 'page not found' });
|
||||
}
|
||||
}*/
|
||||
|
||||
route.meta.title = data.value?.title;
|
||||
</script>
|
||||
|
@ -47,8 +47,8 @@
|
||||
}
|
||||
]" />
|
||||
<DocsReadersNav section-id="forUsers" id="forUsers" />
|
||||
<!--<DocsReadersNav section-id="forAdmin" id="forAdmin" />
|
||||
<DocsReadersNav section-id="forDevelopers" id="forDevelopers" />-->
|
||||
<DocsReadersNav section-id="forAdmin" id="forAdmin" />
|
||||
<DocsReadersNav section-id="forDevelopers" id="forDevelopers" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user