1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00

add backlinks

This commit is contained in:
Fedor Katurov 2023-06-11 20:16:55 +06:00
parent 6222b75563
commit 811e7740a9
21 changed files with 257 additions and 56 deletions

View file

@ -1,7 +1,7 @@
import { Context } from "react";
import { Context } from 'react';
import { ERRORS } from "~/constants/errors";
import { IUser } from "~/types/auth";
import { ERRORS } from '~/constants/errors';
import { IUser } from '~/types/auth';
export interface ITag {
ID: number;
@ -22,7 +22,7 @@ export type ContextValue<T> = T extends Context<infer U> ? U : never;
export type UUID = string;
export type IUploadType = "image" | "text" | "audio" | "video" | "other";
export type IUploadType = 'image' | 'text' | 'audio' | 'video' | 'other';
export interface IFile {
id: number;
@ -55,21 +55,21 @@ export interface IFile {
}
export interface IBlockText {
type: "text";
type: 'text';
text: string;
}
export interface IBlockEmbed {
type: "video";
type: 'video';
url: string;
}
export type IBlock = IBlockText | IBlockEmbed;
export type FlowDisplayVariant =
| "single"
| "vertical"
| "horizontal"
| "quadro";
| 'single'
| 'vertical'
| 'horizontal'
| 'quadro';
export interface FlowDisplay {
display: FlowDisplayVariant;
show_description: boolean;
@ -98,6 +98,7 @@ export interface INode {
like_count?: number;
flow: FlowDisplay;
backlinks?: NodeBackLink[];
tags: ITag[];
@ -109,9 +110,13 @@ export interface INode {
export type IFlowNode = Pick<
INode,
"id" | "flow" | "description" | "title" | "thumbnail" | "created_at"
'id' | 'flow' | 'description' | 'title' | 'thumbnail' | 'created_at'
>;
export interface NodeBackLink {
provider: string;
link: string;
}
export interface IComment {
id: number;
text: string;
@ -123,7 +128,7 @@ export interface IComment {
deleted_at?: string;
}
export type IMessage = Omit<IComment, "user" | "node"> & {
export type IMessage = Omit<IComment, 'user' | 'node'> & {
from: IUser;
to: IUser;
};
@ -132,7 +137,7 @@ export interface ICommentGroup {
user: IUser;
comments: IComment[];
distancesInDays: number[];
ids: IComment["id"][];
ids: IComment['id'][];
hasNew: boolean;
}
@ -140,19 +145,19 @@ export type IUploadProgressHandler = (progress: ProgressEvent) => void;
export type IError = ValueOf<typeof ERRORS>;
export const NOTIFICATION_TYPES = {
message: "message",
comment: "comment",
node: "node",
message: 'message',
comment: 'comment',
node: 'node',
};
export type IMessageNotification = {
type: typeof NOTIFICATION_TYPES["message"];
type: typeof NOTIFICATION_TYPES['message'];
content: Partial<IMessage>;
created_at: string;
};
export type ICommentNotification = {
type: typeof NOTIFICATION_TYPES["comment"];
type: typeof NOTIFICATION_TYPES['comment'];
content: Partial<IComment>;
created_at: string;
};

View file

@ -1,4 +1,4 @@
import { IComment, INode, ITag } from '~/types';
import { IComment, INode, ITag, NodeBackLink } from '~/types';
export interface IEditorComponentProps {}
@ -30,7 +30,11 @@ export type PostCellViewResult = unknown; // TODO: update it with actual type
export type ApiGetNodeRequest = {
id: string | number;
};
export type ApiGetNodeResponse = { node: INode; last_seen?: string | null };
export type ApiGetNodeResponse = {
node: INode;
backlinks?: NodeBackLink[];
last_seen?: string | null;
};
export type ApiGetNodeRelatedRequest = {
id: INode['id'];