tycho-components 0.0.18-SNAPSHOT-8 → 0.0.18-SNAPSHOT-9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Comments/CommentAdd.d.ts +16 -0
- package/dist/Comments/CommentAdd.js +73 -0
- package/dist/Comments/CommentInfo.d.ts +11 -0
- package/dist/Comments/CommentInfo.js +32 -0
- package/dist/Comments/Comments.d.ts +1 -1
- package/dist/Comments/Comments.js +47 -78
- package/dist/Comments/style.scss +57 -31
- package/dist/Comments/types/Comment.d.ts +4 -3
- package/dist/Comments/types/CommentService.js +1 -1
- package/dist/configs/Localization.d.ts +6 -0
- package/dist/configs/localization/CommentsTexts.d.ts +6 -0
- package/dist/configs/localization/CommentsTexts.js +8 -2
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { User } from '../configs/User';
|
|
2
|
+
import './style.scss';
|
|
3
|
+
import { Comment } from './types/Comment';
|
|
4
|
+
type Props = {
|
|
5
|
+
uid: string;
|
|
6
|
+
mode: 'lexicon' | 'corpus' | 'parser';
|
|
7
|
+
users: User[];
|
|
8
|
+
references: Record<string, string | number | boolean>;
|
|
9
|
+
keywords?: Record<string, string | number | boolean>;
|
|
10
|
+
comment?: Comment;
|
|
11
|
+
reply?: Comment;
|
|
12
|
+
onClose: () => void;
|
|
13
|
+
onChange: (r: Comment) => void;
|
|
14
|
+
};
|
|
15
|
+
export default function CommentAdd({ uid, mode, users, references, keywords, comment, reply, onClose, onChange, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
3
|
+
import { useForm } from 'react-hook-form';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { Button, SelectField, TextField } from 'tycho-storybook';
|
|
6
|
+
import * as yup from 'yup';
|
|
7
|
+
import { useMessageUtils } from '../configs/useMessageUtils';
|
|
8
|
+
import FormUtils from '../functions/FormUtils';
|
|
9
|
+
import './style.scss';
|
|
10
|
+
import { EMPTY_COMMENT_REQUEST, } from './types/Comment';
|
|
11
|
+
import CommentService from './types/CommentService';
|
|
12
|
+
export default function CommentAdd({ uid, mode, users, references, keywords, comment, reply, onClose, onChange, }) {
|
|
13
|
+
const { t } = useTranslation('comments');
|
|
14
|
+
const { isLoading, dispatchLoading } = useMessageUtils();
|
|
15
|
+
const getFormDefaultValues = () => {
|
|
16
|
+
if (comment)
|
|
17
|
+
return {
|
|
18
|
+
value: comment.value,
|
|
19
|
+
title: comment.title,
|
|
20
|
+
requested: comment.requested?.map((r) => r.uid),
|
|
21
|
+
};
|
|
22
|
+
if (reply) {
|
|
23
|
+
console.log({
|
|
24
|
+
...EMPTY_COMMENT_REQUEST,
|
|
25
|
+
reply: reply.id,
|
|
26
|
+
requested: [reply.user],
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
...EMPTY_COMMENT_REQUEST,
|
|
30
|
+
reply: reply.id,
|
|
31
|
+
requested: [reply.user],
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return EMPTY_COMMENT_REQUEST;
|
|
35
|
+
};
|
|
36
|
+
const createdForm = useForm({
|
|
37
|
+
resolver: yupResolver(getFormSchema(t)),
|
|
38
|
+
mode: 'onChange',
|
|
39
|
+
defaultValues: getFormDefaultValues(),
|
|
40
|
+
});
|
|
41
|
+
const handleAdd = () => {
|
|
42
|
+
if (isLoading())
|
|
43
|
+
return;
|
|
44
|
+
dispatchLoading(true);
|
|
45
|
+
CommentService.add(uid, mode, createdForm.getValues(), references, keywords).then((r) => {
|
|
46
|
+
dispatchLoading(false);
|
|
47
|
+
onClose();
|
|
48
|
+
onChange(r.data);
|
|
49
|
+
createdForm.reset(EMPTY_COMMENT_REQUEST);
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
const handleUpdate = () => {
|
|
53
|
+
if (!comment)
|
|
54
|
+
return;
|
|
55
|
+
CommentService.update(comment.id, createdForm.getValues()).then((r) => {
|
|
56
|
+
onClose();
|
|
57
|
+
onChange(r.data);
|
|
58
|
+
createdForm.reset(EMPTY_COMMENT_REQUEST);
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
return (_jsxs("div", { className: "form", children: [_jsx(TextField, { label: t('input.value'), attr: "value", createdForm: createdForm, showEndAdornment: false, placeholder: t('common:generic.placeholder'), required: true, multiline: true }), _jsx(TextField, { label: t('input.title'), attr: "title", createdForm: createdForm, showEndAdornment: false, placeholder: t('common:generic.placeholder') }), _jsx(SelectField, { label: reply ? t('input.user.reply') : t('input.user'), attr: "requested", createdForm: createdForm, options: [
|
|
62
|
+
{
|
|
63
|
+
label: t('common:generic.placeholder.select'),
|
|
64
|
+
value: '',
|
|
65
|
+
},
|
|
66
|
+
...FormUtils.convertList(users, 'name', 'uid'),
|
|
67
|
+
], showEndAdornment: false, multiple: true }), _jsxs("div", { className: "buttons", children: [_jsx(Button, { onClick: onClose, text: t('button.discard'), color: "danger" }), _jsx(Button, { onClick: comment ? handleUpdate : handleAdd, text: comment ? t('label.button.update') : t('label.button.add'), disabled: !createdForm.formState.isValid })] })] }));
|
|
68
|
+
}
|
|
69
|
+
const getFormSchema = (t) => yup.object().shape({
|
|
70
|
+
title: yup.string().optional(),
|
|
71
|
+
value: yup.string().required(t('common:validation.required')),
|
|
72
|
+
requested: yup.array().of(yup.string().defined()).optional(),
|
|
73
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import './style.scss';
|
|
2
|
+
import { Comment } from './types/Comment';
|
|
3
|
+
type Props = {
|
|
4
|
+
comment: Comment;
|
|
5
|
+
onRemove: () => void;
|
|
6
|
+
onUpdate: (c: Comment) => void;
|
|
7
|
+
onEdit: () => void;
|
|
8
|
+
onReply: () => void;
|
|
9
|
+
};
|
|
10
|
+
export default function CommentInfo({ comment, onRemove, onUpdate, onEdit, onReply, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useContext, useState } from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { Avatar, IconButton } from 'tycho-storybook';
|
|
5
|
+
import CommonContext from '../configs/CommonContext';
|
|
6
|
+
import DateUtils from '../functions/DateUtils';
|
|
7
|
+
import './style.scss';
|
|
8
|
+
import CommentService from './types/CommentService';
|
|
9
|
+
export default function CommentInfo({ comment, onRemove, onUpdate, onEdit, onReply, }) {
|
|
10
|
+
const { t } = useTranslation('comments');
|
|
11
|
+
const { state } = useContext(CommonContext);
|
|
12
|
+
const [comments, setComments] = useState();
|
|
13
|
+
const handleMarkRead = () => {
|
|
14
|
+
CommentService.markRead(comment.id).then((r) => {
|
|
15
|
+
onUpdate(r.data);
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
const handleRemove = () => {
|
|
19
|
+
CommentService.remove(comment.id).then(() => {
|
|
20
|
+
onRemove();
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
const isNotRead = (thisComment) => {
|
|
24
|
+
if (!thisComment.requested)
|
|
25
|
+
return false;
|
|
26
|
+
const requested = thisComment.requested.find((r) => r.uid === state.logged?.uid);
|
|
27
|
+
if (!requested)
|
|
28
|
+
return false;
|
|
29
|
+
return !requested.read;
|
|
30
|
+
};
|
|
31
|
+
return (_jsxs("div", { className: "comment", children: [_jsxs("div", { className: "top", children: [_jsx(Avatar, { title: comment.name, src: comment.picture, size: comment.reply ? 'small' : 'medium' }), _jsx("div", { className: "name", children: comment.name }), _jsxs("div", { className: "buttons", children: [!comment.reply && (_jsx(IconButton, { size: "small", onClick: onReply, title: t('tooltip.reply'), name: "reply" })), state.logged?.uid === comment.user && (_jsxs(_Fragment, { children: [_jsx(IconButton, { size: comment.reply ? 'x-small' : 'small', onClick: onEdit, title: t('tooltip.edit'), name: "edit" }), _jsx(IconButton, { size: comment.reply ? 'x-small' : 'small', onClick: handleRemove, title: t('tooltip.delete'), name: "delete" })] })), isNotRead(comment) && (_jsx(IconButton, { size: comment.reply ? 'x-small' : 'small', onClick: handleMarkRead, title: t('tooltip.read'), name: "check_circle" }))] })] }), _jsxs("div", { className: "content", children: [comment.title && _jsx("div", { className: "title", children: comment.title }), _jsx("div", { className: "text", children: comment.value }), comment.requested && (_jsxs("div", { className: "date", children: [_jsx("span", { className: "me-1", children: t('label.requested.to') }), _jsx("span", { children: comment.requested.map((e) => e.name).join(', ') })] })), _jsxs("div", { className: "date", children: [_jsx("span", { className: "me-1", children: t('label.posted.on') }), _jsx("span", { className: "me-1", children: DateUtils.formatDateTime(comment.edited ? comment.edited : comment.date, 'MM/dd/yyyy - HH:mm') }), comment.edited && _jsx("i", { children: t('label.edited') })] })] })] }));
|
|
32
|
+
}
|
|
@@ -8,5 +8,5 @@ type Props = {
|
|
|
8
8
|
mode: 'lexicon' | 'corpus' | 'parser';
|
|
9
9
|
onChange?: (a: Comment[]) => void;
|
|
10
10
|
};
|
|
11
|
-
export default function Comments({ uid, keywords, references,
|
|
11
|
+
export default function Comments({ uid, keywords, references, mode, onClose, onChange, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -1,33 +1,24 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
2
|
-
import { yupResolver } from '@hookform/resolvers/yup';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
2
|
import { Drawer } from '@mui/material';
|
|
4
3
|
import { useContext, useEffect, useMemo, useState } from 'react';
|
|
5
|
-
import { useForm } from 'react-hook-form';
|
|
6
4
|
import { useTranslation } from 'react-i18next';
|
|
7
|
-
import {
|
|
8
|
-
import * as yup from 'yup';
|
|
5
|
+
import { Button, IconButton } from 'tycho-storybook';
|
|
9
6
|
import AppLoading from '../AppLoading';
|
|
10
7
|
import AppPlaceholder from '../AppPlaceholder';
|
|
11
8
|
import CommonContext from '../configs/CommonContext';
|
|
12
|
-
import { useMessageUtils } from '../configs/useMessageUtils';
|
|
13
|
-
import DateUtils from '../functions/DateUtils';
|
|
14
|
-
import FormUtils from '../functions/FormUtils';
|
|
15
9
|
import SecurityUtils from '../functions/SecurityUtils';
|
|
10
|
+
import CommentAdd from './CommentAdd';
|
|
11
|
+
import CommentInfo from './CommentInfo';
|
|
16
12
|
import './style.scss';
|
|
17
|
-
import { EMPTY_COMMENT_REQUEST, } from './types/Comment';
|
|
18
13
|
import CommentService from './types/CommentService';
|
|
19
|
-
export default function Comments({ uid, keywords, references,
|
|
14
|
+
export default function Comments({ uid, keywords, references, mode, onClose, onChange, }) {
|
|
20
15
|
const { t } = useTranslation('comments');
|
|
21
16
|
const { state } = useContext(CommonContext);
|
|
22
|
-
const { isLoading, dispatchLoading } = useMessageUtils();
|
|
23
17
|
const [openAddComment, setOpenAddComment] = useState(false);
|
|
24
18
|
const [comment, setComment] = useState();
|
|
25
19
|
const [comments, setComments] = useState();
|
|
26
20
|
const [users, setUsers] = useState([]);
|
|
27
|
-
const
|
|
28
|
-
resolver: yupResolver(getFormSchema(t)),
|
|
29
|
-
mode: 'onChange',
|
|
30
|
-
});
|
|
21
|
+
const [reply, setReply] = useState();
|
|
31
22
|
const load = async () => {
|
|
32
23
|
try {
|
|
33
24
|
const [commentsResponse, usersResponse] = await Promise.all([
|
|
@@ -42,76 +33,54 @@ export default function Comments({ uid, keywords, references, onClose, mode, onC
|
|
|
42
33
|
// optionally handle specific error state here
|
|
43
34
|
}
|
|
44
35
|
};
|
|
45
|
-
const handleAdd = () => {
|
|
46
|
-
if (isLoading())
|
|
47
|
-
return;
|
|
48
|
-
dispatchLoading(true);
|
|
49
|
-
CommentService.add(uid, mode, createdForm.getValues(), references, keywords).then((r) => {
|
|
50
|
-
dispatchLoading(false);
|
|
51
|
-
setOpenAddComment(false);
|
|
52
|
-
setComment(undefined);
|
|
53
|
-
const updated = [...(comments || []), r.data];
|
|
54
|
-
setComments(updated);
|
|
55
|
-
onChange && onChange(updated);
|
|
56
|
-
createdForm.reset(EMPTY_COMMENT_REQUEST);
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
|
-
const handleMarkRead = (thisComment) => {
|
|
60
|
-
CommentService.markRead(thisComment.id).then(() => {
|
|
61
|
-
const updated = { ...thisComment, read: true };
|
|
62
|
-
setComments(comments?.map((c) => c.id === thisComment.id ? { ...c, ...updated } : c));
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
const handleRemove = (thisComment) => {
|
|
66
|
-
CommentService.remove(thisComment.id).then(() => {
|
|
67
|
-
const updated = comments?.filter((c) => c.id !== thisComment.id);
|
|
68
|
-
setComments(updated);
|
|
69
|
-
onChange && onChange(updated || []);
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
const handleEdit = (thisComment) => {
|
|
73
|
-
setComment(thisComment);
|
|
74
|
-
setOpenAddComment(true);
|
|
75
|
-
createdForm.reset({
|
|
76
|
-
value: thisComment.value,
|
|
77
|
-
title: thisComment.title,
|
|
78
|
-
requestedUser: thisComment.requested?.uid,
|
|
79
|
-
});
|
|
80
|
-
const updated = comments?.map((c) => c.id === thisComment.id ? { ...c, ...thisComment } : c);
|
|
81
|
-
onChange && onChange(updated || []);
|
|
82
|
-
};
|
|
83
|
-
const handleUpdate = () => {
|
|
84
|
-
if (!comment)
|
|
85
|
-
return;
|
|
86
|
-
CommentService.update(comment.id, createdForm.getValues()).then((r) => {
|
|
87
|
-
setComments((prev) => prev?.map((c) => (c.id === comment.id ? r.data : c)));
|
|
88
|
-
setComment(undefined);
|
|
89
|
-
setOpenAddComment(false);
|
|
90
|
-
});
|
|
91
|
-
};
|
|
92
36
|
const hasEditAccess = useMemo(() => {
|
|
93
37
|
return SecurityUtils.hasAccess(uid, ['ADMIN', 'EDITOR'], mode);
|
|
94
38
|
}, [uid]);
|
|
39
|
+
const hasReplies = (thisComment) => comments && comments.some((c) => c.reply === thisComment.id);
|
|
40
|
+
const getReplies = (thisComment) => comments?.filter((c) => c.reply === thisComment.id) || [];
|
|
95
41
|
useEffect(() => {
|
|
96
42
|
load();
|
|
97
43
|
}, []);
|
|
98
44
|
return (_jsx(Drawer, { anchor: "right", open: true, onClose: onClose, children: !comments ? (_jsx(AppLoading, {})) : (_jsxs("div", { className: "comments-container", children: [_jsxs("div", { className: "header", children: [_jsx(IconButton, { name: "close", size: "small", mode: "ghost", onClick: onClose }), _jsx("span", { className: "title", children: t('label.title.comments') }), _jsx("div", { className: "actions", children: hasEditAccess && (_jsx(Button, { text: t('button.add'), icon: "add", mode: "outlined", size: "small", className: "edit-button", onClick: () => {
|
|
99
45
|
setComment(undefined);
|
|
100
46
|
setOpenAddComment(!openAddComment);
|
|
101
|
-
} })) })] }), _jsxs("div", { className: "body", children: [openAddComment && (
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
47
|
+
} })) })] }), _jsxs("div", { className: "body", children: [openAddComment && (_jsx(CommentAdd, { uid: uid, mode: mode, users: users, references: references, keywords: keywords, comment: comment, reply: reply, onClose: () => {
|
|
48
|
+
setComment(undefined);
|
|
49
|
+
setReply(undefined);
|
|
50
|
+
setOpenAddComment(false);
|
|
51
|
+
}, onChange: (el) => {
|
|
52
|
+
if (!comment) {
|
|
53
|
+
const updated = [...(comments || []), el];
|
|
54
|
+
setComments(updated);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
setComments((prev) => prev?.map((c) => (c.id === comment.id ? el : c)));
|
|
58
|
+
}
|
|
59
|
+
} })), comments?.length === 0 && (_jsx(AppPlaceholder, { text: t('placeholder.comments.empty') })), comments?.map((el, idx) => (_jsxs("div", { className: "thread", children: [!el.reply && (_jsx(CommentInfo, { comment: el, onRemove: () => {
|
|
60
|
+
const updated = comments?.filter((c) => c.id !== el.id);
|
|
61
|
+
setComments(updated);
|
|
62
|
+
onChange && onChange(updated || []);
|
|
63
|
+
}, onUpdate: (thisComment) => {
|
|
64
|
+
setComments(comments?.map((c) => c.id === thisComment.id ? { ...c, ...thisComment } : c));
|
|
65
|
+
}, onEdit: () => {
|
|
66
|
+
setComment(el);
|
|
67
|
+
setOpenAddComment(true);
|
|
68
|
+
}, onReply: () => {
|
|
69
|
+
setReply(el);
|
|
70
|
+
setOpenAddComment(true);
|
|
71
|
+
} })), hasReplies(el) && (_jsx("div", { className: "replies", children: getReplies(el).map((rel, idy) => (_jsx(CommentInfo, { comment: rel, onRemove: () => {
|
|
72
|
+
const updated = comments?.filter((c) => c.id !== rel.id);
|
|
73
|
+
setComments(updated);
|
|
74
|
+
onChange && onChange(updated || []);
|
|
75
|
+
}, onUpdate: (thisComment) => {
|
|
76
|
+
setComments(comments?.map((c) => c.id === thisComment.id
|
|
77
|
+
? { ...c, ...thisComment }
|
|
78
|
+
: c));
|
|
79
|
+
}, onEdit: () => {
|
|
80
|
+
setComment(rel);
|
|
81
|
+
setOpenAddComment(true);
|
|
82
|
+
}, onReply: () => {
|
|
83
|
+
setReply(rel);
|
|
84
|
+
setOpenAddComment(true);
|
|
85
|
+
} }, `${idx}_${idy}`))) }))] }, idx.valueOf())))] })] })) }));
|
|
112
86
|
}
|
|
113
|
-
const getFormSchema = (t) => yup.object().shape({
|
|
114
|
-
title: yup.string().optional(),
|
|
115
|
-
value: yup.string().required(t('common:validation.required')),
|
|
116
|
-
requestedUser: yup.string().optional(),
|
|
117
|
-
});
|
package/dist/Comments/style.scss
CHANGED
|
@@ -30,51 +30,77 @@
|
|
|
30
30
|
background-color: #fff;
|
|
31
31
|
padding: 16px;
|
|
32
32
|
|
|
33
|
-
.
|
|
34
|
-
display: flex;
|
|
35
|
-
flex-direction: column;
|
|
36
|
-
padding: var(--spacing-150) var(--spacing-100);
|
|
33
|
+
.thread {
|
|
37
34
|
border-bottom: 1px solid var(--border-subtle-1);
|
|
38
35
|
|
|
39
|
-
.
|
|
36
|
+
.comment {
|
|
40
37
|
display: flex;
|
|
41
|
-
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
padding: var(--spacing-150) var(--spacing-100);
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
.top {
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
|
|
45
|
+
> .ds-avatar {
|
|
46
|
+
margin-right: 8px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.buttons {
|
|
50
|
+
display: flex;
|
|
51
|
+
margin-left: auto;
|
|
52
|
+
gap: 8px;
|
|
53
|
+
|
|
54
|
+
button {
|
|
55
|
+
border: none;
|
|
56
|
+
border-radius: var(--border-radius-button);
|
|
57
|
+
cursor: pointer;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
45
60
|
}
|
|
46
61
|
|
|
47
|
-
.
|
|
48
|
-
|
|
49
|
-
margin-left: auto;
|
|
50
|
-
gap: 8px;
|
|
62
|
+
.content {
|
|
63
|
+
margin-top: 16px;
|
|
51
64
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
65
|
+
.title {
|
|
66
|
+
@include tag-medium-1;
|
|
67
|
+
color: var(--text-accent);
|
|
68
|
+
text-transform: none;
|
|
69
|
+
margin-bottom: 4px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.text {
|
|
73
|
+
@include body-medium-1;
|
|
74
|
+
color: var(--text-primary);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.date {
|
|
78
|
+
@include helper-small-1;
|
|
79
|
+
color: var(--text-tertiary);
|
|
80
|
+
margin-top: 8px;
|
|
56
81
|
}
|
|
57
82
|
}
|
|
58
83
|
}
|
|
59
84
|
|
|
60
|
-
.
|
|
61
|
-
margin-
|
|
85
|
+
.replies {
|
|
86
|
+
margin-left: 32px;
|
|
62
87
|
|
|
63
|
-
.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
88
|
+
.comment {
|
|
89
|
+
.top {
|
|
90
|
+
.name {
|
|
91
|
+
font-size: 14px !important;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
68
94
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
95
|
+
.content {
|
|
96
|
+
.title {
|
|
97
|
+
font-size: 13px !important;
|
|
98
|
+
}
|
|
73
99
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
100
|
+
.text {
|
|
101
|
+
font-size: 13px !important;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
78
104
|
}
|
|
79
105
|
}
|
|
80
106
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type CommentRequest = {
|
|
2
2
|
title?: string;
|
|
3
3
|
value?: string;
|
|
4
|
-
|
|
4
|
+
requested?: string[];
|
|
5
5
|
};
|
|
6
6
|
export type Comment = {
|
|
7
7
|
id: string;
|
|
@@ -19,16 +19,17 @@ export type Comment = {
|
|
|
19
19
|
page?: string;
|
|
20
20
|
sentence?: string;
|
|
21
21
|
cid?: string;
|
|
22
|
-
requested?: UserComment;
|
|
23
|
-
read?: boolean;
|
|
22
|
+
requested?: UserComment[];
|
|
24
23
|
keywords?: Record<string, string>;
|
|
25
24
|
type?: string;
|
|
25
|
+
reply?: string;
|
|
26
26
|
};
|
|
27
27
|
export type UserComment = {
|
|
28
28
|
uid: string;
|
|
29
29
|
name: string;
|
|
30
30
|
picture: string;
|
|
31
31
|
email: string;
|
|
32
|
+
read: boolean;
|
|
32
33
|
};
|
|
33
34
|
export declare const EMPTY_COMMENT: Comment;
|
|
34
35
|
export declare const EMPTY_COMMENT_REQUEST: CommentRequest;
|
|
@@ -6,7 +6,7 @@ function findReadNotifications(uid, mode) {
|
|
|
6
6
|
return api.get(`${import.meta.env.VITE_APP_COMMENT_API_URL}/${mode}/notifications/read/${uid}`);
|
|
7
7
|
}
|
|
8
8
|
function markRead(id) {
|
|
9
|
-
return api.put(`${import.meta.env.VITE_APP_COMMENT_API_URL}/${id}`);
|
|
9
|
+
return api.put(`${import.meta.env.VITE_APP_COMMENT_API_URL}/read/${id}`);
|
|
10
10
|
}
|
|
11
11
|
function update(id, comment) {
|
|
12
12
|
return api.patch(`${import.meta.env.VITE_APP_COMMENT_API_URL}/${id}`, { ...comment });
|
|
@@ -62,6 +62,7 @@ export declare const commonResources: {
|
|
|
62
62
|
'tooltip.edit': string;
|
|
63
63
|
'tooltip.delete': string;
|
|
64
64
|
'tooltip.read': string;
|
|
65
|
+
'tooltip.reply': string;
|
|
65
66
|
'modal.title.footnote': string;
|
|
66
67
|
'placeholder.footnote.text': string;
|
|
67
68
|
'modal.title.footnote.remove': string;
|
|
@@ -70,12 +71,14 @@ export declare const commonResources: {
|
|
|
70
71
|
'input.value': string;
|
|
71
72
|
'input.title': string;
|
|
72
73
|
'input.user': string;
|
|
74
|
+
'input.user.reply': string;
|
|
73
75
|
'button.discard': string;
|
|
74
76
|
'notification.title': string;
|
|
75
77
|
'notification.unread': string;
|
|
76
78
|
'notification.all': string;
|
|
77
79
|
'notification.empty': string;
|
|
78
80
|
'notification.text': string;
|
|
81
|
+
'label.edited': string;
|
|
79
82
|
};
|
|
80
83
|
header: {
|
|
81
84
|
'label.platform': string;
|
|
@@ -195,6 +198,7 @@ export declare const commonResources: {
|
|
|
195
198
|
'tooltip.edit': string;
|
|
196
199
|
'tooltip.delete': string;
|
|
197
200
|
'tooltip.read': string;
|
|
201
|
+
'tooltip.reply': string;
|
|
198
202
|
'modal.title.footnote': string;
|
|
199
203
|
'placeholder.footnote.text': string;
|
|
200
204
|
'modal.title.footnote.remove': string;
|
|
@@ -203,12 +207,14 @@ export declare const commonResources: {
|
|
|
203
207
|
'input.value': string;
|
|
204
208
|
'input.title': string;
|
|
205
209
|
'input.user': string;
|
|
210
|
+
'input.user.reply': string;
|
|
206
211
|
'button.discard': string;
|
|
207
212
|
'notification.title': string;
|
|
208
213
|
'notification.unread': string;
|
|
209
214
|
'notification.all': string;
|
|
210
215
|
'notification.empty': string;
|
|
211
216
|
'notification.text': string;
|
|
217
|
+
'label.edited': string;
|
|
212
218
|
};
|
|
213
219
|
header: {
|
|
214
220
|
'label.platform': string;
|
|
@@ -12,6 +12,7 @@ export declare const CommentsTexts: {
|
|
|
12
12
|
'tooltip.edit': string;
|
|
13
13
|
'tooltip.delete': string;
|
|
14
14
|
'tooltip.read': string;
|
|
15
|
+
'tooltip.reply': string;
|
|
15
16
|
'modal.title.footnote': string;
|
|
16
17
|
'placeholder.footnote.text': string;
|
|
17
18
|
'modal.title.footnote.remove': string;
|
|
@@ -20,12 +21,14 @@ export declare const CommentsTexts: {
|
|
|
20
21
|
'input.value': string;
|
|
21
22
|
'input.title': string;
|
|
22
23
|
'input.user': string;
|
|
24
|
+
'input.user.reply': string;
|
|
23
25
|
'button.discard': string;
|
|
24
26
|
'notification.title': string;
|
|
25
27
|
'notification.unread': string;
|
|
26
28
|
'notification.all': string;
|
|
27
29
|
'notification.empty': string;
|
|
28
30
|
'notification.text': string;
|
|
31
|
+
'label.edited': string;
|
|
29
32
|
};
|
|
30
33
|
'pt-BR': {
|
|
31
34
|
'label.title.comments': string;
|
|
@@ -40,6 +43,7 @@ export declare const CommentsTexts: {
|
|
|
40
43
|
'tooltip.edit': string;
|
|
41
44
|
'tooltip.delete': string;
|
|
42
45
|
'tooltip.read': string;
|
|
46
|
+
'tooltip.reply': string;
|
|
43
47
|
'modal.title.footnote': string;
|
|
44
48
|
'placeholder.footnote.text': string;
|
|
45
49
|
'modal.title.footnote.remove': string;
|
|
@@ -48,11 +52,13 @@ export declare const CommentsTexts: {
|
|
|
48
52
|
'input.value': string;
|
|
49
53
|
'input.title': string;
|
|
50
54
|
'input.user': string;
|
|
55
|
+
'input.user.reply': string;
|
|
51
56
|
'button.discard': string;
|
|
52
57
|
'notification.title': string;
|
|
53
58
|
'notification.unread': string;
|
|
54
59
|
'notification.all': string;
|
|
55
60
|
'notification.empty': string;
|
|
56
61
|
'notification.text': string;
|
|
62
|
+
'label.edited': string;
|
|
57
63
|
};
|
|
58
64
|
};
|
|
@@ -12,6 +12,7 @@ export const CommentsTexts = {
|
|
|
12
12
|
'tooltip.edit': 'Edit comment',
|
|
13
13
|
'tooltip.delete': 'Remove comment',
|
|
14
14
|
'tooltip.read': 'Mark as read',
|
|
15
|
+
'tooltip.reply': 'Reply',
|
|
15
16
|
'modal.title.footnote': 'Edit footnote',
|
|
16
17
|
'placeholder.footnote.text': 'Enter footnote',
|
|
17
18
|
'modal.title.footnote.remove': 'Confirm footnote removal',
|
|
@@ -19,13 +20,15 @@ export const CommentsTexts = {
|
|
|
19
20
|
'button.add': 'Add comment',
|
|
20
21
|
'input.value': 'Comment',
|
|
21
22
|
'input.title': 'Title',
|
|
22
|
-
'input.user': 'Send to
|
|
23
|
+
'input.user': 'Send to users',
|
|
24
|
+
'input.user.reply': 'Reply to users',
|
|
23
25
|
'button.discard': 'Discard',
|
|
24
26
|
'notification.title': 'Notifications',
|
|
25
27
|
'notification.unread': 'Unread',
|
|
26
28
|
'notification.all': 'Read',
|
|
27
29
|
'notification.empty': 'No more notifications',
|
|
28
30
|
'notification.text': '{{user}} added a comment to entry {{entry}}.',
|
|
31
|
+
'label.edited': 'edited',
|
|
29
32
|
},
|
|
30
33
|
'pt-BR': {
|
|
31
34
|
'label.title.comments': 'Comentários',
|
|
@@ -40,6 +43,7 @@ export const CommentsTexts = {
|
|
|
40
43
|
'tooltip.edit': 'Editar commentário',
|
|
41
44
|
'tooltip.delete': 'Remover commentário',
|
|
42
45
|
'tooltip.read': 'Marcar como lido',
|
|
46
|
+
'tooltip.reply': 'Responder',
|
|
43
47
|
'modal.title.footnote': 'Editar nota de rodapé',
|
|
44
48
|
'placeholder.footnote.text': 'Entre o texto da nota de rodapé',
|
|
45
49
|
'modal.title.footnote.remove': 'Confirmação de exclusão de nota de rodapé',
|
|
@@ -47,12 +51,14 @@ export const CommentsTexts = {
|
|
|
47
51
|
'button.add': 'Adicionar comentário',
|
|
48
52
|
'input.value': 'Comentário',
|
|
49
53
|
'input.title': 'Título',
|
|
50
|
-
'input.user': 'Enviar para
|
|
54
|
+
'input.user': 'Enviar para usuários',
|
|
55
|
+
'input.user.reply': 'Responder para usuários',
|
|
51
56
|
'button.discard': 'Descartar',
|
|
52
57
|
'notification.title': 'Notificações',
|
|
53
58
|
'notification.unread': 'Não lidas',
|
|
54
59
|
'notification.all': 'Lidas',
|
|
55
60
|
'notification.empty': 'Não há notificações',
|
|
56
61
|
'notification.text': '{{user}} adicionou um comentário na entrada {{entry}}.',
|
|
62
|
+
'label.edited': 'editado',
|
|
57
63
|
},
|
|
58
64
|
};
|