diff --git a/public/src/components/NoteEditor/NoteEditor.tsx b/public/src/components/NoteEditor/NoteEditor.tsx index 0412b7e0..6a906a21 100644 --- a/public/src/components/NoteEditor/NoteEditor.tsx +++ b/public/src/components/NoteEditor/NoteEditor.tsx @@ -8,6 +8,7 @@ import {AppNoteStore, NoteStoreActions} from '../../modules/stores/NoteStore'; import {Modal} from '../Modal/Modal'; import {DeleteNoteDialog} from '../DeleteNoteDialog/DeleteNoteDialog'; import NoteMenu from "../NoteMenu/NoteMenu"; +import {InviteUserModal} from "../InviteUserModal/InviteUserModal"; import {Tooltip} from "../Tooltip/Tooltip"; import {TagList} from "../TagList/TagList"; import {EditorWrapper} from "../Editor/EditorWrapper"; @@ -45,17 +46,18 @@ export class NoteEditor extends ScReact.Component ({ ...state, noteStatus: "sync", })); } + }; openDeleteNoteModal = () => { @@ -293,6 +298,11 @@ export class NoteEditor extends ScReact.Component} /> + } + /> + { render() { const isOwner = this.props.note?.owner_id == AppUserStore.state.user_id + const isAuth = AppUserStore.state.isAuth return (
@@ -101,8 +102,8 @@ export class NoteMenu extends ScReact.Component {
: "" } - {isOwner ? -
+ {isAuth ? +
{this.props.note?.favorite ? "Удалить из избранного" : "В избранное"}
: "" diff --git a/public/src/components/SharePanel/SharePanel.tsx b/public/src/components/SharePanel/SharePanel.tsx index 5613b4b6..736da451 100644 --- a/public/src/components/SharePanel/SharePanel.tsx +++ b/public/src/components/SharePanel/SharePanel.tsx @@ -3,13 +3,16 @@ import {Button} from "../Button/Button"; import "./SharePanel.sass" import {ToggleButton} from "../ToggleButton/ToggleButton"; import {Img} from "../Image/Image"; -import {NotesActions} from "../../modules/stores/NotesStore"; +import {AppNotesStore, NotesActions} from "../../modules/stores/NotesStore"; import {parseNoteTitle} from "../../modules/utils"; import {AppDispatcher} from "../../modules/dispatcher"; import {AppToasts} from "../../modules/toasts"; +import {AppUserStore} from "../../modules/stores/UserStore"; export class SharePanel extends ScReact.Component { + private inviteInputRef + handleToggle = (value:boolean) => { AppDispatcher.dispatch(value ? NotesActions.SET_PUBLIC : NotesActions.SET_PRIVATE) } @@ -43,6 +46,25 @@ export class SharePanel extends ScReact.Component { AppToasts.info("Ссылка на заметку скопирована") } + sendInvite = (e) => { + e.preventDefault() + console.log("sendInvite") + + const value = this.inviteInputRef.value + + if (value == AppUserStore.state.username) { + AppToasts.info("Вы не можете пригласить самого себя") + return + } + + if (value) { + AppDispatcher.dispatch(NotesActions.ADD_COLLABORATOR, { + note_id: AppNotesStore.state.selectedNote.id, + username: value + }) + } + } + getNoteURL = () => "https://you-note.ru/notes/" + this.props.note?.id render() { @@ -50,10 +72,10 @@ export class SharePanel extends ScReact.Component {

Пригласить людей

-
- +
+ this.inviteInputRef = ref}/>
+

Поделиться ссылкой

diff --git a/public/src/modules/stores/NotesStore.ts b/public/src/modules/stores/NotesStore.ts index b97d69f0..95441f18 100644 --- a/public/src/modules/stores/NotesStore.ts +++ b/public/src/modules/stores/NotesStore.ts @@ -626,7 +626,7 @@ class NotesStore extends BaseStore { if (status == 204) { AppToasts.success("Приглашение успешно отправлено") } else { - AppToasts.success("Пользователя не существует") + AppToasts.error("Пользователь не найден") } } catch { diff --git a/public/src/utils/variables.sass b/public/src/utils/variables.sass index 629a034b..ecabf098 100644 --- a/public/src/utils/variables.sass +++ b/public/src/utils/variables.sass @@ -24,5 +24,5 @@ $xs: 320px $sm: 576px $md: 768px $lg: 992px -$xl: 1200px +$xl: 1240px $xxl: 1650px \ No newline at end of file