diff --git a/app/components/post-details/FrontmatterEditor.tsx b/app/components/post-details/FrontmatterEditor.tsx index bc8afcf..c03e5f0 100644 --- a/app/components/post-details/FrontmatterEditor.tsx +++ b/app/components/post-details/FrontmatterEditor.tsx @@ -1,3 +1,4 @@ +import type { Permissions } from "@/lib/github" import type { CollectionFile, ProjectConfig } from "@/lib/projects.server" import { buttonCN, inputCN, labelCN } from "@/lib/styles" import { PlusIcon, XMarkIcon } from "@heroicons/react/20/solid" @@ -7,11 +8,7 @@ import { useState } from "react" type LoaderData = { file: CollectionFile, config: ProjectConfig, - permissions: { - admin: boolean - push: boolean - pull: boolean - } + permissions: Permissions } export default function FrontmatterEditor({ onDraft }: { onDraft: () => void }) { diff --git a/app/components/post-details/PostEditor.tsx b/app/components/post-details/PostEditor.tsx index 384d883..216f327 100644 --- a/app/components/post-details/PostEditor.tsx +++ b/app/components/post-details/PostEditor.tsx @@ -6,15 +6,12 @@ import MarkdownEditor from "./markdown-editor/MarkdownEditor" import MarkdownPreview from "./markdown-editor/MarkdownPreview" import clsx from "clsx" import { ArrowLeftIcon, DocumentMagnifyingGlassIcon } from "@heroicons/react/24/outline" +import type { Permissions } from "@/lib/github" type LoaderData = { file: CollectionFile, config: ProjectConfig, - permissions: { - admin: boolean - push: boolean - pull: boolean - } + permissions: Permissions } export default function PostEditor({ onDraft }: { onDraft: () => void }) { diff --git a/app/components/source-files/FileDetails.tsx b/app/components/source-files/FileDetails.tsx index 545c205..65a0b2d 100644 --- a/app/components/source-files/FileDetails.tsx +++ b/app/components/source-files/FileDetails.tsx @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react' import FileEditor from './FileEditor' -import type { ParsedFile } from '@/lib/github' +import type { ParsedFile, Permissions } from '@/lib/github' import FileLabel from './FileLabel' import { Form, Link, useLoaderData, useParams, useTransition } from '@remix-run/react' import { buttonCN } from '@/lib/styles' @@ -9,11 +9,7 @@ import { useProject } from '@/lib/useProjectConfig' type LoaderData = { branch: string file: ParsedFile - permissions: { - admin: boolean - push: boolean - pull: boolean - } + permissions: Permissions } function BackIcon() { diff --git a/app/routes/p/$project/$cid/$pid.tsx b/app/routes/p/$project/$cid/$pid.tsx index 9aa1732..5f1b1bf 100644 --- a/app/routes/p/$project/$cid/$pid.tsx +++ b/app/routes/p/$project/$cid/$pid.tsx @@ -1,3 +1,4 @@ +import type { Permissions} from "@/lib/github" import { deleteFile, getFileContent, getRepoDetails, saveFile } from "@/lib/github" import type { CollectionFile, ProjectConfig } from "@/lib/projects.server" import { processFileContent } from "@/lib/projects.server" @@ -19,11 +20,7 @@ import PostDetailsHeader from "@/components/post-details/PostDetailHeader" type LoaderData = { file: CollectionFile, config: ProjectConfig, - permissions: { - admin: boolean - push: boolean - pull: boolean - } + permissions: Permissions } export const meta: MetaFunction = ({ data }) => { diff --git a/app/routes/p/$project/settings.tsx b/app/routes/p/$project/settings.tsx index d60e212..6255d4c 100644 --- a/app/routes/p/$project/settings.tsx +++ b/app/routes/p/$project/settings.tsx @@ -1,6 +1,6 @@ import { ComboBoxLocal } from "@/components/ComboBoxLocal" import type { TreeItem} from "@/lib/github" -import { getRepoFiles } from "@/lib/github" +import { FileMode, getRepoFiles } from "@/lib/github" import metaTitle from "@/lib/metaTitle" import { getProject, getProjectConfig, updateConfigFile } from "@/lib/projects.server" import { deleteConfigFile, deleteProject, updateProject } from "@/lib/projects.server" @@ -71,9 +71,9 @@ export async function loader({ params, request }: LoaderArgs) { tree.unshift({ path: '/', type: 'tree' as const, - url: '', - mode: '', + mode: FileMode.TREE, sha: '', + url: '', }) return json({ tree: tree.filter((t) => t.type === 'tree') })