lemmy-ui/src/shared/interfaces.ts

77 lines
1.3 KiB
TypeScript
Raw Normal View History

import { CommentView, GetSiteResponse, LemmyHttp } from "lemmy-js-client";
import type { ParsedQs } from "qs";
import { ErrorPageData } from "./utils";
/**
* This contains serialized data, it needs to be deserialized before use.
*/
2023-05-30 00:40:00 +00:00
export interface IsoData<T extends object = any> {
path: string;
2023-05-30 00:40:00 +00:00
routeData: T;
2020-12-24 01:58:27 +00:00
site_res: GetSiteResponse;
errorPageData?: ErrorPageData;
}
2023-05-30 00:40:00 +00:00
export type IsoDataOptionalSite<T extends object = any> = Partial<IsoData<T>> &
Pick<IsoData<T>, Exclude<keyof IsoData<T>, "site_res">>;
2023-05-14 23:49:55 +00:00
export interface ILemmyConfig {
wsHost?: string;
}
declare global {
interface Window {
isoData: IsoData;
lemmyConfig?: ILemmyConfig;
}
}
export interface InitialFetchRequest<T extends ParsedQs = ParsedQs> {
auth?: string;
client: LemmyHttp;
path: string;
query: T;
site: GetSiteResponse;
}
2020-12-24 01:58:27 +00:00
export interface PostFormParams {
name?: string;
url?: string;
body?: string;
2020-12-24 01:58:27 +00:00
}
export enum CommentViewType {
Tree,
Flat,
}
export enum DataType {
Post,
Comment,
}
export enum BanType {
Community,
Site,
}
2021-03-15 18:09:31 +00:00
export enum PersonDetailsView {
Overview = "Overview",
Comments = "Comments",
Posts = "Posts",
Saved = "Saved",
}
export enum PurgeType {
Person,
Community,
Post,
Comment,
}
export interface CommentNodeI {
comment_view: CommentView;
children: Array<CommentNodeI>;
depth: number;
}