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.
*/
export interface IsoData {
path: string;
routeData: any[];
2020-12-24 01:58:27 +00:00
site_res: GetSiteResponse;
errorPageData?: ErrorPageData;
}
2023-05-14 23:49:55 +00:00
export type IsoDataOptionalSite = Partial<IsoData> &
Pick<IsoData, Exclude<keyof IsoData, "site_res">>;
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;
}