lemmy-ui/src/shared/interfaces.ts
Dessalines 9dcaff4301
Adding image upload views for admins and profiles. (#2424)
* Adding image upload views for admins and profiles.

* Upgraded lemmy-js-client dep.

* Removing this.

* Upgrade to pnpm v9.0.1

---------

Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com>
2024-04-17 08:37:58 -04:00

102 lines
1.9 KiB
TypeScript

import { ErrorPageData } from "@utils/types";
import {
CommentReply,
CommentView,
GetSiteResponse,
PersonMention,
} from "lemmy-js-client";
import { RequestState } from "./services/HttpService";
import { Match } from "inferno-router/dist/Route";
/**
* This contains serialized data, it needs to be deserialized before use.
*/
export interface IsoData<T extends RouteData = any> {
path: string;
routeData: T;
site_res: GetSiteResponse;
errorPageData?: ErrorPageData;
}
export type IsoDataOptionalSite<T extends RouteData = any> = Partial<
IsoData<T>
> &
Pick<IsoData<T>, Exclude<keyof IsoData<T>, "site_res">>;
declare global {
interface Window {
isoData: IsoData;
checkLazyScripts?: () => void;
}
}
export interface InitialFetchRequest<
P extends Record<string, string> = Record<string, never>,
T extends Record<string, any> = Record<string, never>,
> {
path: string;
query: T;
match: Match<P>;
site: GetSiteResponse;
headers: { [key: string]: string };
}
export interface PostFormParams {
name?: string;
url?: string;
body?: string;
}
export enum CommentViewType {
Tree,
Flat,
}
export enum DataType {
Post,
Comment,
}
export enum BanType {
Community,
Site,
}
export enum PersonDetailsView {
Overview = "Overview",
Comments = "Comments",
Posts = "Posts",
Saved = "Saved",
Uploads = "Uploads",
}
export enum PurgeType {
Person,
Community,
Post,
Comment,
}
export enum VoteType {
Upvote,
Downvote,
}
export enum VoteContentType {
Post,
Comment,
}
export type CommentNodeView = Omit<CommentView, "banned_from_community"> &
Partial<Pick<CommentView, "banned_from_community">> & {
person_mention?: PersonMention;
comment_reply?: CommentReply;
};
export interface CommentNodeI {
comment_view: CommentNodeView;
children: Array<CommentNodeI>;
depth: number;
}
export type RouteData = Record<string, RequestState<any>>;