datocms-plugin-record-comments 0.1.0
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/README.md +8 -0
- package/build/asset-manifest.json +13 -0
- package/build/index.html +1 -0
- package/build/robots.txt +3 -0
- package/build/static/css/main.19c0232f.css +2 -0
- package/build/static/css/main.19c0232f.css.map +1 -0
- package/build/static/js/main.255a6b09.js +3 -0
- package/build/static/js/main.255a6b09.js.LICENSE.txt +59 -0
- package/build/static/js/main.255a6b09.js.map +1 -0
- package/docs/cover.jpg +0 -0
- package/docs/demo.mp4 +0 -0
- package/package.json +65 -0
- package/public/index.html +11 -0
- package/public/robots.txt +3 -0
- package/src/entrypoints/CommentsBar.tsx +254 -0
- package/src/entrypoints/NoLogModal.tsx +43 -0
- package/src/entrypoints/components/Comment.tsx +260 -0
- package/src/entrypoints/styles/comment.module.css +134 -0
- package/src/entrypoints/styles/commentbar.module.css +3 -0
- package/src/entrypoints/styles/modal.module.css +13 -0
- package/src/index.tsx +45 -0
- package/src/react-app-env.d.ts +1 -0
- package/src/utils/render.tsx +6 -0
- package/tsconfig.json +26 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
.comment-main {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: space-around;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.author-profile-picture {
|
|
7
|
+
border-radius: 5px;
|
|
8
|
+
width: 50px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.comment__buttons {
|
|
12
|
+
display: flex;
|
|
13
|
+
justify-content: left;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.comment__button {
|
|
17
|
+
background-color: transparent;
|
|
18
|
+
border: none;
|
|
19
|
+
color: var(--light-body-color);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.comment__button:hover {
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
color: var(--dark-color);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.comment {
|
|
28
|
+
margin-bottom: 3em;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.reply {
|
|
32
|
+
margin-bottom: 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.author-info {
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
align-items: center;
|
|
39
|
+
padding: 1em;
|
|
40
|
+
flex-grow: 1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.reply {
|
|
44
|
+
margin-left: 30px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.comment-body {
|
|
48
|
+
flex-grow: 8;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.comment-textarea {
|
|
52
|
+
background-color: var(--lighter-bg-color);
|
|
53
|
+
border: solid var(--border-color);
|
|
54
|
+
resize: none;
|
|
55
|
+
font: inherit;
|
|
56
|
+
width: 100%;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.comment-footer {
|
|
60
|
+
font-size: var(--font-size-s);
|
|
61
|
+
display: flex;
|
|
62
|
+
justify-content: center;
|
|
63
|
+
align-items: center;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.comment__buttons {
|
|
67
|
+
display: flex;
|
|
68
|
+
flex-direction: column;
|
|
69
|
+
align-items: baseline;
|
|
70
|
+
width: 90%;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.comment__timestamps {
|
|
74
|
+
color: var(--light-body-color);
|
|
75
|
+
font-size: var(--font-size-xs);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.tip {
|
|
79
|
+
width: 0px;
|
|
80
|
+
height: 0px;
|
|
81
|
+
position: absolute;
|
|
82
|
+
background: transparent;
|
|
83
|
+
border: 10px solid var(--light-bg-color);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.tip-down {
|
|
87
|
+
bottom: -25px;
|
|
88
|
+
left: 10px;
|
|
89
|
+
border-right-color: transparent;
|
|
90
|
+
border-left-color: transparent;
|
|
91
|
+
border-bottom-color: transparent;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.dialogbox .body {
|
|
95
|
+
position: relative;
|
|
96
|
+
max-width: 300px;
|
|
97
|
+
height: auto;
|
|
98
|
+
padding: 5px;
|
|
99
|
+
background-color: var(--light-bg-color);
|
|
100
|
+
border-radius: 3px;
|
|
101
|
+
border: 5px solid var(--light-bg-color);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.body .message {
|
|
105
|
+
border-radius: 3px;
|
|
106
|
+
font-size: var(--font-size-s);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.reply-line {
|
|
110
|
+
content: "";
|
|
111
|
+
width: 2px;
|
|
112
|
+
height: 80px;
|
|
113
|
+
background: var(--darker-border-color);
|
|
114
|
+
position: absolute;
|
|
115
|
+
left: 32px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.reply-profile-picture-line {
|
|
119
|
+
content: "";
|
|
120
|
+
width: 30px;
|
|
121
|
+
height: 2px;
|
|
122
|
+
background: var(--darker-border-color);
|
|
123
|
+
position: absolute;
|
|
124
|
+
left: 32px;
|
|
125
|
+
z-index: -1;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.upvoted {
|
|
129
|
+
color: var(--dark-color);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.comment__interface {
|
|
133
|
+
color: var(--light-body-color);
|
|
134
|
+
}
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
connect,
|
|
3
|
+
IntentCtx,
|
|
4
|
+
ModelBlock,
|
|
5
|
+
RenderItemFormSidebarPanelCtx,
|
|
6
|
+
RenderModalCtx,
|
|
7
|
+
} from "datocms-plugin-sdk";
|
|
8
|
+
import { render } from "./utils/render";
|
|
9
|
+
import "datocms-react-ui/styles.css";
|
|
10
|
+
import React from "react";
|
|
11
|
+
import ReactDOM from "react-dom";
|
|
12
|
+
import Notes from "./entrypoints/CommentsBar";
|
|
13
|
+
import NoLogModal from "./entrypoints/NoLogModal";
|
|
14
|
+
import TimeAgo from "javascript-time-ago";
|
|
15
|
+
import en from "javascript-time-ago/locale/en.json";
|
|
16
|
+
|
|
17
|
+
TimeAgo.addDefaultLocale(en);
|
|
18
|
+
connect({
|
|
19
|
+
renderModal(modalId: string, ctx: RenderModalCtx) {
|
|
20
|
+
switch (modalId) {
|
|
21
|
+
case "NoLogModal":
|
|
22
|
+
return render(<NoLogModal ctx={ctx} />);
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
itemFormSidebarPanels(model: ModelBlock, ctx: IntentCtx) {
|
|
26
|
+
return [
|
|
27
|
+
{
|
|
28
|
+
id: "comments",
|
|
29
|
+
label: "Comments",
|
|
30
|
+
startOpen: false,
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
},
|
|
34
|
+
renderItemFormSidebarPanel(
|
|
35
|
+
sidebarPanelId,
|
|
36
|
+
ctx: RenderItemFormSidebarPanelCtx
|
|
37
|
+
) {
|
|
38
|
+
ReactDOM.render(
|
|
39
|
+
<React.StrictMode>
|
|
40
|
+
<Notes ctx={ctx} />
|
|
41
|
+
</React.StrictMode>,
|
|
42
|
+
document.getElementById("root")
|
|
43
|
+
);
|
|
44
|
+
},
|
|
45
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="react-scripts" />
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es5",
|
|
4
|
+
"lib": [
|
|
5
|
+
"dom",
|
|
6
|
+
"dom.iterable",
|
|
7
|
+
"esnext"
|
|
8
|
+
],
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"allowSyntheticDefaultImports": true,
|
|
13
|
+
"strict": true,
|
|
14
|
+
"forceConsistentCasingInFileNames": true,
|
|
15
|
+
"noFallthroughCasesInSwitch": true,
|
|
16
|
+
"module": "esnext",
|
|
17
|
+
"moduleResolution": "node",
|
|
18
|
+
"resolveJsonModule": true,
|
|
19
|
+
"isolatedModules": true,
|
|
20
|
+
"noEmit": true,
|
|
21
|
+
"jsx": "react-jsx"
|
|
22
|
+
},
|
|
23
|
+
"include": [
|
|
24
|
+
"src"
|
|
25
|
+
]
|
|
26
|
+
}
|