2023-05-11 18:32:32 +00:00
|
|
|
import { CommentView, GetSiteResponse, LemmyHttp } from "lemmy-js-client";
|
2023-04-15 14:47:10 +00:00
|
|
|
import type { ParsedQs } from "qs";
|
2023-05-17 00:34:15 +00:00
|
|
|
import { ErrorPageData } from "./utils";
|
2020-09-07 03:41:46 +00:00
|
|
|
|
2022-06-21 21:42:29 +00:00
|
|
|
/**
|
|
|
|
* 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> {
|
2020-09-07 03:41:46 +00:00
|
|
|
path: string;
|
2023-05-30 00:40:00 +00:00
|
|
|
routeData: T;
|
2020-12-24 01:58:27 +00:00
|
|
|
site_res: GetSiteResponse;
|
2023-05-17 00:34:15 +00:00
|
|
|
errorPageData?: ErrorPageData;
|
2020-09-07 03:41:46 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2021-02-12 17:54:35 +00:00
|
|
|
export interface ILemmyConfig {
|
|
|
|
wsHost?: string;
|
|
|
|
}
|
|
|
|
|
2020-09-07 03:41:46 +00:00
|
|
|
declare global {
|
|
|
|
interface Window {
|
|
|
|
isoData: IsoData;
|
2021-02-12 17:54:35 +00:00
|
|
|
lemmyConfig?: ILemmyConfig;
|
2020-09-07 03:41:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-15 14:47:10 +00:00
|
|
|
export interface InitialFetchRequest<T extends ParsedQs = ParsedQs> {
|
2023-01-04 16:56:24 +00:00
|
|
|
auth?: string;
|
2020-11-12 21:56:46 +00:00
|
|
|
client: LemmyHttp;
|
2022-06-21 21:42:29 +00:00
|
|
|
path: string;
|
2023-04-15 14:47:10 +00:00
|
|
|
query: T;
|
|
|
|
site: GetSiteResponse;
|
2020-11-12 21:56:46 +00:00
|
|
|
}
|
|
|
|
|
2020-12-24 01:58:27 +00:00
|
|
|
export interface PostFormParams {
|
2023-01-04 16:56:24 +00:00
|
|
|
name?: string;
|
|
|
|
url?: string;
|
|
|
|
body?: string;
|
2020-12-24 01:58:27 +00:00
|
|
|
}
|
|
|
|
|
2020-09-06 16:15:25 +00:00
|
|
|
export enum CommentViewType {
|
|
|
|
Tree,
|
2022-07-30 13:28:08 +00:00
|
|
|
Flat,
|
2020-09-06 16:15:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export enum DataType {
|
|
|
|
Post,
|
|
|
|
Comment,
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum BanType {
|
|
|
|
Community,
|
|
|
|
Site,
|
|
|
|
}
|
|
|
|
|
2021-03-15 18:09:31 +00:00
|
|
|
export enum PersonDetailsView {
|
2023-04-15 14:47:10 +00:00
|
|
|
Overview = "Overview",
|
|
|
|
Comments = "Comments",
|
|
|
|
Posts = "Posts",
|
|
|
|
Saved = "Saved",
|
2020-09-06 16:15:25 +00:00
|
|
|
}
|
2022-06-23 19:44:05 +00:00
|
|
|
|
|
|
|
export enum PurgeType {
|
|
|
|
Person,
|
|
|
|
Community,
|
|
|
|
Post,
|
|
|
|
Comment,
|
|
|
|
}
|
2023-05-11 18:32:32 +00:00
|
|
|
|
|
|
|
export interface CommentNodeI {
|
|
|
|
comment_view: CommentView;
|
|
|
|
children: Array<CommentNodeI>;
|
|
|
|
depth: number;
|
|
|
|
}
|