1
0
Fork 0
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:
muerwre 2022-08-12 14:07:19 +07:00 committed by GitHub
parent fe3db608d6
commit 5d34090238
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
72 changed files with 1241 additions and 664 deletions

View file

@ -43,6 +43,7 @@ export const ERRORS = {
MESSAGE_NOT_FOUND: 'MessageNotFound',
COMMENT_TOO_LONG: 'CommentTooLong',
NETWORK_ERROR: 'Network Error',
NOTE_NOT_FOUND: 'NoteNotFound',
};
export const ERROR_LITERAL = {
@ -74,9 +75,12 @@ export const ERROR_LITERAL = {
[ERRORS.INCORRECT_NODE_TYPE]: 'Ты пытаешься отправить пост неизвестного типа',
[ERRORS.UNEXPECTED_BEHAVIOR]: 'Что-то пошло не так. Напишите об этом Борису',
[ERRORS.FILES_IS_TOO_BIG]: 'Файл слишком большой',
[ERRORS.OAUTH_CODE_IS_EMPTY]: 'Мы не смогли получить код от социальной сети. Попробуй ещё раз.',
[ERRORS.OAUTH_UNKNOWN_PROVIDER]: 'Ты пытаешься войти с помощью неизвестной социальной сети',
[ERRORS.OAUTH_INVALID_DATA]: 'Социальная сеть вернула какую-то дичь. Попробуй ещё раз.',
[ERRORS.OAUTH_CODE_IS_EMPTY]:
'Мы не смогли получить код от социальной сети. Попробуй ещё раз.',
[ERRORS.OAUTH_UNKNOWN_PROVIDER]:
'Ты пытаешься войти с помощью неизвестной социальной сети',
[ERRORS.OAUTH_INVALID_DATA]:
'Социальная сеть вернула какую-то дичь. Попробуй ещё раз.',
[ERRORS.USERNAME_IS_SHORT]: 'Хотя бы 2 символа',
[ERRORS.USERNAME_CONTAINS_INVALID_CHARS]: 'Буквы, цифры и подчёркивание',
[ERRORS.PASSWORD_IS_SHORT]: 'Хотя бы 6 символов',
@ -91,4 +95,5 @@ export const ERROR_LITERAL = {
[ERRORS.MESSAGE_NOT_FOUND]: 'Сообщение не найдено',
[ERRORS.COMMENT_TOO_LONG]: 'Комментарий слишком длинный',
[ERRORS.NETWORK_ERROR]: 'Подключение не удалось',
[ERRORS.NOTE_NOT_FOUND]: 'Заметка не найдена',
};

View file

@ -1,5 +1,4 @@
export enum EventMessageType {
OpenProfile = 'open_profile',
OAuthLogin = 'oauth_login',
OAuthProcessed = 'oauth_processed',
OAuthError = 'oauth_error',

View file

@ -4,18 +4,15 @@ import { LoadingDialog } from '~/containers/dialogs/LoadingDialog';
import { LoginDialog } from '~/containers/dialogs/LoginDialog';
import { LoginSocialRegisterDialog } from '~/containers/dialogs/LoginSocialRegisterDialog';
import { PhotoSwipe } from '~/containers/dialogs/PhotoSwipe';
import { ProfileDialog } from '~/containers/dialogs/ProfileDialog';
import { RestorePasswordDialog } from '~/containers/dialogs/RestorePasswordDialog';
import { RestoreRequestDialog } from '~/containers/dialogs/RestoreRequestDialog';
import { TestDialog } from '~/containers/dialogs/TestDialog';
import { ProfileSidebar } from '~/containers/sidebars/ProfileSidebar';
import { TagSidebar } from '~/containers/sidebars/TagSidebar';
export enum Dialog {
Login = 'Login',
LoginSocialRegister = 'LoginSocialRegister',
Loading = 'Loading',
Profile = 'Profile',
RestoreRequest = 'RestoreRequest',
RestorePassword = 'RestorePassword',
Test = 'Test',
@ -23,7 +20,6 @@ export enum Dialog {
CreateNode = 'CreateNode',
EditNode = 'EditNode',
TagSidebar = 'TagNodes',
ProfileSidebar = 'ProfileSidebar',
}
export const DIALOG_CONTENT = {
@ -31,12 +27,10 @@ export const DIALOG_CONTENT = {
[Dialog.LoginSocialRegister]: LoginSocialRegisterDialog,
[Dialog.Loading]: LoadingDialog,
[Dialog.Test]: TestDialog,
[Dialog.Profile]: ProfileDialog,
[Dialog.RestoreRequest]: RestoreRequestDialog,
[Dialog.RestorePassword]: RestorePasswordDialog,
[Dialog.Photoswipe]: PhotoSwipe,
[Dialog.CreateNode]: EditorCreateDialog,
[Dialog.EditNode]: EditorEditDialog,
[Dialog.TagSidebar]: TagSidebar,
[Dialog.ProfileSidebar]: ProfileSidebar,
} as const;

View file

@ -0,0 +1,9 @@
import { ProfileSidebar } from "~/containers/sidebars/ProfileSidebar";
import { SidebarName } from "./index";
export const sidebarComponents = {
[SidebarName.Settings]: ProfileSidebar,
};
export type SidebarComponents = typeof sidebarComponents;

View file

@ -1,11 +1,5 @@
import { FC, ReactNode } from "react";
import { ProfileSidebar } from "~/containers/sidebars/ProfileSidebar";
export enum SidebarName {
Settings = 'settings'
Settings = "settings",
}
export const sidebarComponents = {
[SidebarName.Settings]: ProfileSidebar
}

View file

@ -1,48 +1,49 @@
import { FlowDisplayVariant, INode } from '~/types';
import { FlowDisplayVariant, INode } from "~/types";
export const URLS = {
BASE: '/',
LAB: '/lab',
BORIS: '/boris',
BASE: "/",
LAB: "/lab",
BORIS: "/boris",
AUTH: {
LOGIN: '/auth/login',
LOGIN: "/auth/login",
},
EXAMPLES: {
EDITOR: '/examples/edit',
IMAGE: '/examples/image',
EDITOR: "/examples/edit",
IMAGE: "/examples/image",
},
ERRORS: {
NOT_FOUND: '/lost',
BACKEND_DOWN: '/oopsie',
NOT_FOUND: "/lost",
BACKEND_DOWN: "/oopsie",
},
NODE_URL: (id: INode['id'] | string) => `/post${id}`,
NODE_URL: (id: INode["id"] | string) => `/post${id}`,
PROFILE_PAGE: (username: string) => `/profile/${username}`,
SETTINGS: {
BASE: '/settings',
NOTES: '/settings/notes',
TRASH: '/settings/trash',
BASE: "/settings",
NOTES: "/settings/notes",
TRASH: "/settings/trash",
},
NOTES: '/notes/',
NOTES: "/notes/",
NOTE: (id: number) => `/notes/${id}`,
};
export const ImagePresets = {
'1600': '1600',
'600': '600',
'300': '300',
cover: 'cover',
small_hero: 'small_hero',
avatar: 'avatar',
flow_square: 'flow_square',
flow_vertical: 'flow_vertical',
flow_horizontal: 'flow_horizontal',
"1600": "1600",
"600": "600",
"300": "300",
cover: "cover",
small_hero: "small_hero",
avatar: "avatar",
flow_square: "flow_square",
flow_vertical: "flow_vertical",
flow_horizontal: "flow_horizontal",
} as const;
export const flowDisplayToPreset: Record<
FlowDisplayVariant,
typeof ImagePresets[keyof typeof ImagePresets]
> = {
single: 'flow_square',
quadro: 'flow_square',
vertical: 'flow_vertical',
horizontal: 'flow_horizontal',
single: "flow_square",
quadro: "flow_square",
vertical: "flow_vertical",
horizontal: "flow_horizontal",
};