lemmy-ui/src/shared/interfaces.ts
SleeplessOne1917 643c1f6f01
Make confirm popup for adult consent (#2419)
* Make confirm popup for adult consent

* Fix import

* Fix blur and adjust user settings

* Make confirmation popup more stylish

* Add setting to site settings form

* Fix modal bug

* Put adult consent logic all in one place

* Make modal use markdown

* Fix consent modal showing up for currently logged in admin

* Add go-back redirect countdown

* Center modal title

* Handle enable_nsfw correctly

* Blur background of modal to hide spicy things

* Add translations
2024-04-18 19:54:16 -04:00

103 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;
showAdultConsentModal: boolean;
}
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>>;