mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
Добавили заметки в сайдбар (#126)
* added notes sidebar * added note dropping and editing * added sidebar navigation * handling sidebarchanges over time * using router back for closing sidebar * fixed tripping inside single sidebar * added superpowers toggle to sidebar * user button opens sidebar now * added profile cover for profile sidebar * removed profile sidebar completely * ran prettier over project * added note not found error literal
This commit is contained in:
parent
fe3db608d6
commit
5d34090238
72 changed files with 1241 additions and 664 deletions
|
@ -1,5 +1,7 @@
|
|||
import { ERRORS } from '~/constants/errors';
|
||||
import { IUser } from '~/types/auth';
|
||||
import { Context } from "react";
|
||||
|
||||
import { ERRORS } from "~/constants/errors";
|
||||
import { IUser } from "~/types/auth";
|
||||
|
||||
export interface ITag {
|
||||
ID: number;
|
||||
|
@ -16,10 +18,11 @@ export interface ITag {
|
|||
export type IIcon = string;
|
||||
|
||||
export type ValueOf<T> = T[keyof T];
|
||||
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;
|
||||
|
@ -52,17 +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';
|
||||
export type FlowDisplayVariant =
|
||||
| "single"
|
||||
| "vertical"
|
||||
| "horizontal"
|
||||
| "quadro";
|
||||
export interface FlowDisplay {
|
||||
display: FlowDisplayVariant;
|
||||
show_description: boolean;
|
||||
|
@ -102,7 +109,7 @@ export interface INode {
|
|||
|
||||
export type IFlowNode = Pick<
|
||||
INode,
|
||||
'id' | 'flow' | 'description' | 'title' | 'thumbnail' | 'created_at'
|
||||
"id" | "flow" | "description" | "title" | "thumbnail" | "created_at"
|
||||
>;
|
||||
|
||||
export interface IComment {
|
||||
|
@ -116,7 +123,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;
|
||||
};
|
||||
|
@ -125,7 +132,7 @@ export interface ICommentGroup {
|
|||
user: IUser;
|
||||
comments: IComment[];
|
||||
distancesInDays: number[];
|
||||
ids: IComment['id'][];
|
||||
ids: IComment["id"][];
|
||||
hasNew: boolean;
|
||||
}
|
||||
|
||||
|
@ -133,19 +140,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;
|
||||
};
|
||||
|
|
20
src/types/sidebar/index.ts
Normal file
20
src/types/sidebar/index.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import { FunctionComponent } from "react";
|
||||
|
||||
import type { SidebarComponents } from "~/constants/sidebar/components";
|
||||
|
||||
export type SidebarComponent = keyof SidebarComponents;
|
||||
|
||||
// TODO: use it to store props for sidebar
|
||||
export type SidebarProps<
|
||||
T extends SidebarComponent
|
||||
> = SidebarComponents[T] extends FunctionComponent<infer U>
|
||||
? U extends object
|
||||
? U extends SidebarComponentProps<T>
|
||||
? Omit<U, keyof SidebarComponentProps<T>>
|
||||
: U
|
||||
: U
|
||||
: {};
|
||||
export interface SidebarComponentProps<T extends SidebarComponent> {
|
||||
onRequestClose: () => void;
|
||||
openSidebar: (name: T, props: SidebarProps<T>) => void;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue