2023-06-21 22:28:24 +00:00
|
|
|
import { ErrorPageData } from "@utils/types";
|
2024-03-26 23:03:02 +00:00
|
|
|
import {
|
|
|
|
CommentReply,
|
|
|
|
CommentView,
|
|
|
|
GetSiteResponse,
|
|
|
|
PersonMention,
|
|
|
|
} from "lemmy-js-client";
|
2023-12-05 03:07:36 +00:00
|
|
|
import { RequestState } from "./services/HttpService";
|
2024-03-27 13:25:59 +00:00
|
|
|
import { Match } from "inferno-router/dist/Route";
|
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-06-16 22:12:14 +00:00
|
|
|
export interface IsoData<T extends RouteData = 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-06-16 22:12:14 +00:00
|
|
|
export type IsoDataOptionalSite<T extends RouteData = any> = Partial<
|
|
|
|
IsoData<T>
|
|
|
|
> &
|
2023-05-30 00:40:00 +00:00
|
|
|
Pick<IsoData<T>, Exclude<keyof IsoData<T>, "site_res">>;
|
2023-05-14 23:49:55 +00:00
|
|
|
|
2020-09-07 03:41:46 +00:00
|
|
|
declare global {
|
|
|
|
interface Window {
|
|
|
|
isoData: IsoData;
|
2024-03-13 20:39:45 +00:00
|
|
|
checkLazyScripts?: () => void;
|
2020-09-07 03:41:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-27 13:25:59 +00:00
|
|
|
export interface InitialFetchRequest<
|
|
|
|
P extends Record<string, string> = Record<string, never>,
|
|
|
|
T extends Record<string, any> = Record<string, never>,
|
|
|
|
> {
|
2022-06-21 21:42:29 +00:00
|
|
|
path: string;
|
2023-04-15 14:47:10 +00:00
|
|
|
query: T;
|
2024-03-27 13:25:59 +00:00
|
|
|
match: Match<P>;
|
2023-04-15 14:47:10 +00:00
|
|
|
site: GetSiteResponse;
|
2023-12-05 03:07:36 +00:00
|
|
|
headers: { [key: string]: string };
|
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
|
|
|
|
2023-06-14 12:20:40 +00:00
|
|
|
export enum VoteType {
|
|
|
|
Upvote,
|
|
|
|
Downvote,
|
|
|
|
}
|
|
|
|
|
2023-06-23 16:14:24 +00:00
|
|
|
export enum VoteContentType {
|
|
|
|
Post,
|
|
|
|
Comment,
|
|
|
|
}
|
|
|
|
|
2024-03-26 23:03:02 +00:00
|
|
|
export type CommentNodeView = Omit<CommentView, "banned_from_community"> &
|
|
|
|
Partial<Pick<CommentView, "banned_from_community">> & {
|
|
|
|
person_mention?: PersonMention;
|
|
|
|
comment_reply?: CommentReply;
|
|
|
|
};
|
|
|
|
|
2023-05-11 18:32:32 +00:00
|
|
|
export interface CommentNodeI {
|
2024-03-26 23:03:02 +00:00
|
|
|
comment_view: CommentNodeView;
|
2023-05-11 18:32:32 +00:00
|
|
|
children: Array<CommentNodeI>;
|
|
|
|
depth: number;
|
|
|
|
}
|
2023-06-16 22:12:14 +00:00
|
|
|
|
|
|
|
export type RouteData = Record<string, RequestState<any>>;
|