gitalk-react 1.0.0-beta.8 → 1.0.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-zh-CN.md +11 -8
- package/README.md +12 -8
- package/dist/gitalk-dark.css +1 -1
- package/dist/gitalk-light.css +1 -1
- package/dist/gitalk.d.ts +174 -6
- package/dist/gitalk.js +15055 -12611
- package/dist/gitalk.umd.cjs +31 -28
- package/lib/components/action.tsx +6 -6
- package/lib/components/avatar.tsx +6 -6
- package/lib/components/button.tsx +6 -6
- package/lib/components/comment-textarea.tsx +8 -6
- package/lib/components/comment.tsx +28 -9
- package/lib/components/comments-list.tsx +12 -6
- package/lib/components/meta.tsx +12 -8
- package/lib/components/svg.tsx +6 -6
- package/lib/constants/index.ts +23 -9
- package/lib/gitalk.tsx +10 -1
- package/lib/i18n/ar.json +20 -0
- package/lib/i18n/bn.json +20 -0
- package/lib/i18n/hi.json +20 -0
- package/lib/i18n/index.ts +36 -23
- package/lib/i18n/pt.json +20 -0
- package/lib/i18n/ur.json +20 -0
- package/lib/interfaces/index.ts +10 -8
- package/lib/themes/base.scss +9 -7
- package/package.json +30 -27
- /package/lib/i18n/{es-ES.json → es.json} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import cn from "classnames";
|
|
1
2
|
import React from "react";
|
|
2
3
|
|
|
3
|
-
export interface ActionProps
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
> {
|
|
4
|
+
export interface ActionProps extends React.DetailedHTMLProps<
|
|
5
|
+
React.AnchorHTMLAttributes<HTMLAnchorElement>,
|
|
6
|
+
HTMLAnchorElement
|
|
7
|
+
> {
|
|
8
8
|
text: string;
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -13,7 +13,7 @@ const Action: React.FC<ActionProps> = ({
|
|
|
13
13
|
className = "",
|
|
14
14
|
...restProps
|
|
15
15
|
}) => (
|
|
16
|
-
<a className={
|
|
16
|
+
<a className={cn("gt-action", className)} {...restProps}>
|
|
17
17
|
<span className="gt-action-text">{text}</span>
|
|
18
18
|
</a>
|
|
19
19
|
);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import cn from "classnames";
|
|
1
2
|
import React, { useState } from "react";
|
|
2
3
|
|
|
3
4
|
import { DEFAULT_AVATAR } from "../constants";
|
|
4
5
|
|
|
5
|
-
export interface AvatarProps
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
> {
|
|
6
|
+
export interface AvatarProps extends React.DetailedHTMLProps<
|
|
7
|
+
React.AnchorHTMLAttributes<HTMLAnchorElement>,
|
|
8
|
+
HTMLAnchorElement
|
|
9
|
+
> {
|
|
10
10
|
src?: string;
|
|
11
11
|
alt?: string;
|
|
12
12
|
defaultSrc?: string;
|
|
@@ -23,7 +23,7 @@ const Avatar: React.FC<AvatarProps> = ({
|
|
|
23
23
|
|
|
24
24
|
return (
|
|
25
25
|
<a
|
|
26
|
-
className={
|
|
26
|
+
className={cn("gt-avatar", className)}
|
|
27
27
|
target="_blank"
|
|
28
28
|
rel="noopener noreferrer"
|
|
29
29
|
{...restProps}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import cn from "classnames";
|
|
1
2
|
import React from "react";
|
|
2
3
|
|
|
3
|
-
export interface ButtonProps
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
> {
|
|
4
|
+
export interface ButtonProps extends React.DetailedHTMLProps<
|
|
5
|
+
React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
6
|
+
HTMLButtonElement
|
|
7
|
+
> {
|
|
8
8
|
text: string;
|
|
9
9
|
isLoading?: boolean;
|
|
10
10
|
}
|
|
@@ -21,7 +21,7 @@ const Button: React.FC<ButtonProps> = ({
|
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
23
|
<button
|
|
24
|
-
className={
|
|
24
|
+
className={cn("gt-btn", className)}
|
|
25
25
|
style={{ cursor: disabled ? "not-allowed" : undefined, ...style }}
|
|
26
26
|
disabled={disabled}
|
|
27
27
|
{...restProps}
|
|
@@ -10,11 +10,10 @@ import Avatar from "./avatar";
|
|
|
10
10
|
import Button from "./button";
|
|
11
11
|
import Svg from "./svg";
|
|
12
12
|
|
|
13
|
-
interface CommentTextareaProps
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
> {
|
|
13
|
+
interface CommentTextareaProps extends React.DetailedHTMLProps<
|
|
14
|
+
React.TextareaHTMLAttributes<HTMLTextAreaElement>,
|
|
15
|
+
HTMLTextAreaElement
|
|
16
|
+
> {
|
|
18
17
|
value: string;
|
|
19
18
|
octokit: Octokit;
|
|
20
19
|
user?: User;
|
|
@@ -42,6 +41,7 @@ const CommentTextarea = forwardRef<HTMLTextAreaElement, CommentTextareaProps>(
|
|
|
42
41
|
const [isPreviewComment, setIsPreviewComment] = useState<boolean>(false);
|
|
43
42
|
|
|
44
43
|
const prevInputCommentRef = useRef<string>();
|
|
44
|
+
const prevCommentHtmlRef = useRef<string>("");
|
|
45
45
|
|
|
46
46
|
const {
|
|
47
47
|
data: commentHtml = "",
|
|
@@ -49,7 +49,8 @@ const CommentTextarea = forwardRef<HTMLTextAreaElement, CommentTextareaProps>(
|
|
|
49
49
|
run: runGetCommentHtml,
|
|
50
50
|
} = useRequest(
|
|
51
51
|
async (): Promise<string> => {
|
|
52
|
-
if (prevInputCommentRef.current === inputComment)
|
|
52
|
+
if (prevInputCommentRef.current === inputComment)
|
|
53
|
+
return prevCommentHtmlRef.current;
|
|
53
54
|
|
|
54
55
|
const getPreviewedHtmlRes = await octokit.request("POST /markdown", {
|
|
55
56
|
text: inputComment,
|
|
@@ -59,6 +60,7 @@ const CommentTextarea = forwardRef<HTMLTextAreaElement, CommentTextareaProps>(
|
|
|
59
60
|
prevInputCommentRef.current = inputComment;
|
|
60
61
|
|
|
61
62
|
const _commentHtml = getPreviewedHtmlRes.data;
|
|
63
|
+
prevCommentHtmlRef.current = _commentHtml;
|
|
62
64
|
return _commentHtml;
|
|
63
65
|
} else {
|
|
64
66
|
onPreviewError(getPreviewedHtmlRes);
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
+
import cn from "classnames";
|
|
1
2
|
import { formatDistanceToNow, parseISO } from "date-fns";
|
|
2
|
-
import
|
|
3
|
+
import { enUS } from "date-fns/locale";
|
|
4
|
+
import React, {
|
|
5
|
+
useContext,
|
|
6
|
+
useEffect,
|
|
7
|
+
useLayoutEffect,
|
|
8
|
+
useMemo,
|
|
9
|
+
useRef,
|
|
10
|
+
useState,
|
|
11
|
+
} from "react";
|
|
3
12
|
|
|
4
13
|
import ArrowDown from "../assets/arrow-down.svg?raw";
|
|
5
14
|
import Edit from "../assets/edit.svg?raw";
|
|
@@ -12,17 +21,18 @@ import Avatar from "./avatar";
|
|
|
12
21
|
import Svg from "./svg";
|
|
13
22
|
|
|
14
23
|
export interface CommentProps
|
|
15
|
-
extends
|
|
16
|
-
React.
|
|
17
|
-
|
|
18
|
-
|
|
24
|
+
extends
|
|
25
|
+
React.DetailedHTMLProps<
|
|
26
|
+
React.HTMLAttributes<HTMLDivElement>,
|
|
27
|
+
HTMLDivElement
|
|
28
|
+
>,
|
|
29
|
+
Pick<GitalkProps, "collapsedHeight" | "highlightAdminComment"> {
|
|
19
30
|
comment: CommentType;
|
|
20
31
|
isAuthor: boolean;
|
|
21
32
|
isAdmin: boolean;
|
|
22
33
|
onReply: (comment: CommentType) => void;
|
|
23
34
|
onLike: (like: boolean, comment: CommentType) => void;
|
|
24
35
|
likeLoading: boolean;
|
|
25
|
-
collapsedHeight?: GitalkProps["collapsedHeight"];
|
|
26
36
|
}
|
|
27
37
|
|
|
28
38
|
const Comment: React.FC<CommentProps> = ({
|
|
@@ -33,6 +43,7 @@ const Comment: React.FC<CommentProps> = ({
|
|
|
33
43
|
onLike,
|
|
34
44
|
likeLoading,
|
|
35
45
|
collapsedHeight,
|
|
46
|
+
highlightAdminComment,
|
|
36
47
|
className = "",
|
|
37
48
|
...restProps
|
|
38
49
|
}) => {
|
|
@@ -77,12 +88,13 @@ const Comment: React.FC<CommentProps> = ({
|
|
|
77
88
|
return () => {};
|
|
78
89
|
}, []);
|
|
79
90
|
|
|
80
|
-
|
|
91
|
+
useLayoutEffect(() => {
|
|
81
92
|
const commentElement = ref.current;
|
|
82
93
|
|
|
83
94
|
if (commentElement && collapsedHeight) {
|
|
84
95
|
const commentElementHeight = commentElement.clientHeight;
|
|
85
96
|
if (commentElementHeight > collapsedHeight) {
|
|
97
|
+
// eslint-disable-next-line react-hooks/set-state-in-effect
|
|
86
98
|
setCollapsed(true);
|
|
87
99
|
}
|
|
88
100
|
}
|
|
@@ -91,7 +103,14 @@ const Comment: React.FC<CommentProps> = ({
|
|
|
91
103
|
return (
|
|
92
104
|
<div
|
|
93
105
|
ref={ref}
|
|
94
|
-
className={
|
|
106
|
+
className={cn(
|
|
107
|
+
"gt-comment",
|
|
108
|
+
{
|
|
109
|
+
"gt-comment-admin": isAdmin,
|
|
110
|
+
"gt-comment-admin--highlight": isAdmin && highlightAdminComment,
|
|
111
|
+
},
|
|
112
|
+
className,
|
|
113
|
+
)}
|
|
95
114
|
{...restProps}
|
|
96
115
|
>
|
|
97
116
|
<Avatar
|
|
@@ -123,7 +142,7 @@ const Comment: React.FC<CommentProps> = ({
|
|
|
123
142
|
<span className="gt-comment-date__time">
|
|
124
143
|
{formatDistanceToNow(parseISO(created_at), {
|
|
125
144
|
addSuffix: true,
|
|
126
|
-
locale: dateFnsLocaleMap[language],
|
|
145
|
+
locale: dateFnsLocaleMap[language] ?? enUS,
|
|
127
146
|
})}
|
|
128
147
|
</span>
|
|
129
148
|
</div>
|
|
@@ -7,13 +7,18 @@ import Button from "./button";
|
|
|
7
7
|
import Comment, { type CommentProps } from "./comment";
|
|
8
8
|
|
|
9
9
|
interface CommentWithForwardedRefProps
|
|
10
|
-
extends
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
extends
|
|
11
|
+
Pick<
|
|
12
|
+
CommentProps,
|
|
13
|
+
| "comment"
|
|
14
|
+
| "onReply"
|
|
15
|
+
| "likeLoading"
|
|
16
|
+
| "collapsedHeight"
|
|
17
|
+
| "highlightAdminComment"
|
|
18
|
+
>,
|
|
19
|
+
Pick<GitalkProps, "admin"> {
|
|
14
20
|
onLike: (like: boolean, commentId: number, heartReactionId?: number) => void;
|
|
15
21
|
user?: User;
|
|
16
|
-
admin: GitalkProps["admin"];
|
|
17
22
|
}
|
|
18
23
|
|
|
19
24
|
// Why forwardRef? https://www.npmjs.com/package/react-flip-move#usage-with-functional-components
|
|
@@ -55,7 +60,8 @@ const CommentWithForwardedRef = forwardRef<
|
|
|
55
60
|
});
|
|
56
61
|
|
|
57
62
|
interface CommentsListProps
|
|
58
|
-
extends
|
|
63
|
+
extends
|
|
64
|
+
Pick<GitalkProps, "flipMoveOptions">,
|
|
59
65
|
Omit<CommentWithForwardedRefProps, "comment"> {
|
|
60
66
|
comments: CommentType[];
|
|
61
67
|
commentsCount: number;
|
package/lib/components/meta.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import cn from "classnames";
|
|
2
|
+
import React, { useContext, useState } from "react";
|
|
2
3
|
|
|
3
4
|
import ArrowDown from "../assets/arrow-down.svg?raw";
|
|
4
5
|
import { HOMEPAGE, VERSION } from "../constants";
|
|
@@ -8,11 +9,10 @@ import { hasClassInParent } from "../utils/dom";
|
|
|
8
9
|
import Action from "./action";
|
|
9
10
|
import Svg from "./svg";
|
|
10
11
|
|
|
11
|
-
interface MetaProps {
|
|
12
|
+
interface MetaProps extends Pick<GitalkProps, "pagerDirection"> {
|
|
12
13
|
issue?: Issue;
|
|
13
14
|
user?: User;
|
|
14
15
|
commentsCount: number;
|
|
15
|
-
pagerDirection: GitalkProps["pagerDirection"];
|
|
16
16
|
onPagerDirectionChange: (
|
|
17
17
|
direction: NonNullable<GitalkProps["pagerDirection"]>,
|
|
18
18
|
) => void;
|
|
@@ -35,14 +35,14 @@ const Meta: React.FC<MetaProps> = (props) => {
|
|
|
35
35
|
|
|
36
36
|
const [showPopup, setShowPopup] = useState<boolean>(false);
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
function hidePopup(e: MouseEvent) {
|
|
39
39
|
const target = e.target as HTMLElement;
|
|
40
40
|
if (target && hasClassInParent(target, "gt-user", "gt-popup")) {
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
document.removeEventListener("click", hidePopup);
|
|
44
44
|
setShowPopup(false);
|
|
45
|
-
}
|
|
45
|
+
}
|
|
46
46
|
|
|
47
47
|
const onShowOrHidePopup: React.MouseEventHandler<HTMLDivElement> = (e) => {
|
|
48
48
|
e.preventDefault();
|
|
@@ -75,13 +75,17 @@ const Meta: React.FC<MetaProps> = (props) => {
|
|
|
75
75
|
? [
|
|
76
76
|
<Action
|
|
77
77
|
key="sort-asc"
|
|
78
|
-
className={
|
|
78
|
+
className={cn("gt-action-sortasc", {
|
|
79
|
+
"is--active": pagerDirection === "first",
|
|
80
|
+
})}
|
|
79
81
|
onClick={() => onPagerDirectionChange("first")}
|
|
80
82
|
text={polyglot.t("sort-asc")}
|
|
81
83
|
/>,
|
|
82
84
|
<Action
|
|
83
85
|
key="sort-desc"
|
|
84
|
-
className={
|
|
86
|
+
className={cn("gt-action-sortdesc", {
|
|
87
|
+
"is--active": pagerDirection === "last",
|
|
88
|
+
})}
|
|
85
89
|
onClick={() => onPagerDirectionChange("last")}
|
|
86
90
|
text={polyglot.t("sort-desc")}
|
|
87
91
|
/>,
|
|
@@ -113,7 +117,7 @@ const Meta: React.FC<MetaProps> = (props) => {
|
|
|
113
117
|
)}
|
|
114
118
|
<div className="gt-user">
|
|
115
119
|
<div
|
|
116
|
-
className={
|
|
120
|
+
className={cn("gt-user-inner", { "is--poping": showPopup })}
|
|
117
121
|
onClick={onShowOrHidePopup}
|
|
118
122
|
>
|
|
119
123
|
<span className="gt-user-name">
|
package/lib/components/svg.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import cn from "classnames";
|
|
1
2
|
import React from "react";
|
|
2
3
|
|
|
3
|
-
export interface SVGProps
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
> {
|
|
4
|
+
export interface SVGProps extends React.DetailedHTMLProps<
|
|
5
|
+
React.HTMLAttributes<HTMLSpanElement>,
|
|
6
|
+
HTMLSpanElement
|
|
7
|
+
> {
|
|
8
8
|
icon: string;
|
|
9
9
|
text?: string;
|
|
10
10
|
}
|
|
@@ -15,7 +15,7 @@ const Svg: React.FC<SVGProps> = ({
|
|
|
15
15
|
className = "",
|
|
16
16
|
...restProps
|
|
17
17
|
}) => (
|
|
18
|
-
<span className={
|
|
18
|
+
<span className={cn("gt-ico", className)} {...restProps}>
|
|
19
19
|
<span
|
|
20
20
|
className="gt-svg"
|
|
21
21
|
dangerouslySetInnerHTML={{
|
package/lib/constants/index.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ar,
|
|
3
|
+
bn,
|
|
2
4
|
de,
|
|
3
5
|
enUS,
|
|
4
6
|
es,
|
|
5
7
|
faIR,
|
|
6
8
|
fr,
|
|
9
|
+
hi,
|
|
7
10
|
ja,
|
|
8
11
|
ko,
|
|
9
12
|
type Locale,
|
|
10
13
|
pl,
|
|
14
|
+
pt,
|
|
11
15
|
ru,
|
|
12
16
|
zhCN,
|
|
13
17
|
zhTW,
|
|
@@ -22,7 +26,9 @@ export const HOMEPAGE = packageJson.homepage;
|
|
|
22
26
|
|
|
23
27
|
export const DEFAULT_LANG: Lang = "en";
|
|
24
28
|
export const DEFAULT_LABELS = ["Gitalk"];
|
|
25
|
-
export const DEFAULT_FLIP_MOVE_OPTIONS:
|
|
29
|
+
export const DEFAULT_FLIP_MOVE_OPTIONS: NonNullable<
|
|
30
|
+
GitalkProps["flipMoveOptions"]
|
|
31
|
+
> = {
|
|
26
32
|
staggerDelayBy: 150,
|
|
27
33
|
appearAnimation: "accordionVertical",
|
|
28
34
|
enterAnimation: "accordionVertical",
|
|
@@ -42,16 +48,24 @@ export const ACCESS_TOKEN_KEY = "GT_ACCESS_TOKEN";
|
|
|
42
48
|
export const STORED_COMMENTS_KEY = "GT_COMMENT";
|
|
43
49
|
|
|
44
50
|
export const DATE_FNS_LOCALE_MAP: Record<Lang, Locale> = {
|
|
51
|
+
en: enUS,
|
|
45
52
|
zh: zhCN,
|
|
46
53
|
"zh-CN": zhCN,
|
|
54
|
+
"zh-SG": zhCN,
|
|
47
55
|
"zh-TW": zhTW,
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
"zh-HK": zhTW,
|
|
57
|
+
"zh-MO": zhTW,
|
|
58
|
+
hi: hi,
|
|
59
|
+
es: es,
|
|
60
|
+
fr: fr,
|
|
61
|
+
ar: ar,
|
|
62
|
+
bn: bn,
|
|
63
|
+
ru: ru,
|
|
64
|
+
pt: pt,
|
|
65
|
+
ur: enUS,
|
|
66
|
+
ko: ko,
|
|
67
|
+
ja: ja,
|
|
68
|
+
de: de,
|
|
69
|
+
pl: pl,
|
|
55
70
|
fa: faIR,
|
|
56
|
-
ja,
|
|
57
71
|
};
|
package/lib/gitalk.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "./i18n";
|
|
2
2
|
|
|
3
3
|
import { useRequest } from "ahooks";
|
|
4
|
+
import cn from "classnames";
|
|
4
5
|
import React, {
|
|
5
6
|
useCallback,
|
|
6
7
|
useEffect,
|
|
@@ -69,6 +70,7 @@ const Gitalk: React.FC<GitalkProps> = (props) => {
|
|
|
69
70
|
defaultUser: propsDefaultUser,
|
|
70
71
|
defaultAuthor: propsDefaultAuthor,
|
|
71
72
|
collapsedHeight: propsCollapsedHeight,
|
|
73
|
+
highlightAdminComment = true,
|
|
72
74
|
updateCountCallback,
|
|
73
75
|
onCreateIssue,
|
|
74
76
|
onCreateComment,
|
|
@@ -775,7 +777,11 @@ const Gitalk: React.FC<GitalkProps> = (props) => {
|
|
|
775
777
|
return (
|
|
776
778
|
<I18nContext.Provider value={i18nContextValue}>
|
|
777
779
|
<div
|
|
778
|
-
className={
|
|
780
|
+
className={cn(
|
|
781
|
+
"gt-container",
|
|
782
|
+
{ "gt-input-focused": isInputFocused },
|
|
783
|
+
className,
|
|
784
|
+
)}
|
|
779
785
|
{...restProps}
|
|
780
786
|
>
|
|
781
787
|
{/* Alert */}
|
|
@@ -830,6 +836,7 @@ const Gitalk: React.FC<GitalkProps> = (props) => {
|
|
|
830
836
|
onLike={runLikeOrDislikeComment}
|
|
831
837
|
likeLoading={likeOrDislikeCommentLoading}
|
|
832
838
|
collapsedHeight={collapsedHeight}
|
|
839
|
+
highlightAdminComment={highlightAdminComment}
|
|
833
840
|
/>
|
|
834
841
|
</>
|
|
835
842
|
) : (
|
|
@@ -879,4 +886,6 @@ const Gitalk: React.FC<GitalkProps> = (props) => {
|
|
|
879
886
|
|
|
880
887
|
export type { GitalkProps };
|
|
881
888
|
|
|
889
|
+
export { DEFAULT_FLIP_MOVE_OPTIONS };
|
|
890
|
+
|
|
882
891
|
export default Gitalk;
|
package/lib/i18n/ar.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"init": "جارٍ تحميل Gitalk ...",
|
|
3
|
+
"no-found-related": "لم يتم العثور على %{link} ذي صلة للتعليق",
|
|
4
|
+
"please-contact": "يرجى الاتصال بـ %{user} لتهيئة التعليق",
|
|
5
|
+
"init-issue": "إنشاء المشكلة",
|
|
6
|
+
"leave-a-comment": "اترك تعليقًا",
|
|
7
|
+
"preview": "معاينة",
|
|
8
|
+
"edit": "تعديل",
|
|
9
|
+
"comment": "تعليق",
|
|
10
|
+
"support-markdown": "يدعم Markdown",
|
|
11
|
+
"login-with-github": "تسجيل الدخول عبر GitHub",
|
|
12
|
+
"first-comment-person": "كن أول من يترك تعليقًا!",
|
|
13
|
+
"commented": "علق",
|
|
14
|
+
"load-more": "تحميل المزيد",
|
|
15
|
+
"counts": "%{counts} تعليق |||| %{counts} تعليقات",
|
|
16
|
+
"sort-asc": "الترتيب من الأقدم",
|
|
17
|
+
"sort-desc": "الترتيب من الأحدث",
|
|
18
|
+
"logout": "تسجيل الخروج",
|
|
19
|
+
"anonymous": "مجهول"
|
|
20
|
+
}
|
package/lib/i18n/bn.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"init": "Gitalk লোড হচ্ছে ...",
|
|
3
|
+
"no-found-related": "মতামত করার জন্য সম্পর্কিত %{link} পাওয়া যায়নি",
|
|
4
|
+
"please-contact": "মন্তব্য আরম্ভ করতে %{user}-এর সাথে যোগাযোগ করুন",
|
|
5
|
+
"init-issue": "সমস্যা তৈরি করুন",
|
|
6
|
+
"leave-a-comment": "মন্তব্য করুন",
|
|
7
|
+
"preview": "পূর্বরূপ",
|
|
8
|
+
"edit": "সম্পাদনা",
|
|
9
|
+
"comment": "মন্তব্য",
|
|
10
|
+
"support-markdown": "Markdown সমর্থিত",
|
|
11
|
+
"login-with-github": "GitHub দিয়ে লগইন",
|
|
12
|
+
"first-comment-person": "প্রথম মন্তব্যকারী হন!",
|
|
13
|
+
"commented": "মন্তব্য করেছে",
|
|
14
|
+
"load-more": "আরও লোড করুন",
|
|
15
|
+
"counts": "%{counts} মন্তব্য",
|
|
16
|
+
"sort-asc": "প্রাচীন থেকে নতুন ক্রমানুসারে",
|
|
17
|
+
"sort-desc": "নতুন থেকে পুরাতন ক্রমানুসারে",
|
|
18
|
+
"logout": "লগ আউট",
|
|
19
|
+
"anonymous": "নামবিহীন"
|
|
20
|
+
}
|
package/lib/i18n/hi.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"init": "Gitalk लोड हो रहा है ...",
|
|
3
|
+
"no-found-related": "टिप्पणी के लिए संबंधित %{link} नहीं मिला",
|
|
4
|
+
"please-contact": "कृपया टिप्पणी आरंभ करने के लिए %{user} से संपर्क करें",
|
|
5
|
+
"init-issue": "समस्या बनाएँ",
|
|
6
|
+
"leave-a-comment": "एक टिप्पणी छोड़ें",
|
|
7
|
+
"preview": "पूर्वावलोकन",
|
|
8
|
+
"edit": "संपादित करें",
|
|
9
|
+
"comment": "टिप्पणी",
|
|
10
|
+
"support-markdown": "Markdown समर्थित है",
|
|
11
|
+
"login-with-github": "GitHub से लॉगिन करें",
|
|
12
|
+
"first-comment-person": "पहला टिप्पणी करने वाला बनें!",
|
|
13
|
+
"commented": "टिप्पणी की",
|
|
14
|
+
"load-more": "और लोड करें",
|
|
15
|
+
"counts": "%{counts} टिप्पणी |||| %{counts} टिप्पणियाँ",
|
|
16
|
+
"sort-asc": "पुराने से नए क्रम में",
|
|
17
|
+
"sort-desc": "नए से पुराने क्रम में",
|
|
18
|
+
"logout": "लॉगआउट",
|
|
19
|
+
"anonymous": "अनाम"
|
|
20
|
+
}
|
package/lib/i18n/index.ts
CHANGED
|
@@ -1,31 +1,44 @@
|
|
|
1
1
|
import Polyglot from "node-polyglot";
|
|
2
2
|
|
|
3
3
|
import { DEFAULT_LANG } from "../constants";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
4
|
+
import ar from "./ar.json";
|
|
5
|
+
import bn from "./bn.json";
|
|
6
|
+
import de from "./de.json";
|
|
7
|
+
import en from "./en.json";
|
|
8
|
+
import es from "./es.json";
|
|
9
|
+
import fa from "./fa.json";
|
|
10
|
+
import fr from "./fr.json";
|
|
11
|
+
import hi from "./hi.json";
|
|
12
|
+
import ja from "./ja.json";
|
|
13
|
+
import ko from "./ko.json";
|
|
14
|
+
import pl from "./pl.json";
|
|
15
|
+
import pt from "./pt.json";
|
|
16
|
+
import ru from "./ru.json";
|
|
17
|
+
import ur from "./ur.json";
|
|
18
|
+
import zhCN from "./zh-CN.json";
|
|
19
|
+
import zhTW from "./zh-TW.json";
|
|
15
20
|
|
|
16
21
|
export const i18nMap = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"zh-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
en,
|
|
23
|
+
zh: zhCN,
|
|
24
|
+
"zh-CN": zhCN,
|
|
25
|
+
"zh-SG": zhCN,
|
|
26
|
+
"zh-TW": zhTW,
|
|
27
|
+
"zh-HK": zhTW,
|
|
28
|
+
"zh-MO": zhTW,
|
|
29
|
+
hi,
|
|
30
|
+
es,
|
|
31
|
+
fr,
|
|
32
|
+
ar,
|
|
33
|
+
bn,
|
|
34
|
+
ru,
|
|
35
|
+
pt,
|
|
36
|
+
ur,
|
|
37
|
+
ko,
|
|
38
|
+
ja,
|
|
39
|
+
de,
|
|
40
|
+
pl,
|
|
41
|
+
fa,
|
|
29
42
|
};
|
|
30
43
|
|
|
31
44
|
export type Lang = keyof typeof i18nMap;
|
package/lib/i18n/pt.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"init": "Carregando Gitalk ...",
|
|
3
|
+
"no-found-related": "Não foi encontrado %{link} relacionado para comentar",
|
|
4
|
+
"please-contact": "Por favor contate %{user} para inicializar o comentário",
|
|
5
|
+
"init-issue": "Criar problema",
|
|
6
|
+
"leave-a-comment": "Deixe um comentário",
|
|
7
|
+
"preview": "Pré-visualizar",
|
|
8
|
+
"edit": "Editar",
|
|
9
|
+
"comment": "Comentar",
|
|
10
|
+
"support-markdown": "Suporta Markdown",
|
|
11
|
+
"login-with-github": "Entrar com GitHub",
|
|
12
|
+
"first-comment-person": "Seja a primeira pessoa a deixar um comentário!",
|
|
13
|
+
"commented": "comentou",
|
|
14
|
+
"load-more": "Carregar mais",
|
|
15
|
+
"counts": "%{counts} comentário |||| %{counts} comentários",
|
|
16
|
+
"sort-asc": "Ordenar do mais antigo",
|
|
17
|
+
"sort-desc": "Ordenar do mais recente",
|
|
18
|
+
"logout": "Sair",
|
|
19
|
+
"anonymous": "Anônimo"
|
|
20
|
+
}
|
package/lib/i18n/ur.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"init": "Gitalk لوڈ ہو رہا ہے ...",
|
|
3
|
+
"no-found-related": "تبصرہ کرنے کے لیے متعلقہ %{link} نہیں ملا",
|
|
4
|
+
"please-contact": "تبصرہ شروع کرنے کے لیے براہ کرم %{user} سے رابطہ کریں",
|
|
5
|
+
"init-issue": "مسئلہ بنائیں",
|
|
6
|
+
"leave-a-comment": "ایک تبصرہ چھوڑیں",
|
|
7
|
+
"preview": "پیش نظارہ",
|
|
8
|
+
"edit": "ترمیم کریں",
|
|
9
|
+
"comment": "تبصرہ",
|
|
10
|
+
"support-markdown": "Markdown کی حمایت کرتا ہے",
|
|
11
|
+
"login-with-github": "GitHub کے ساتھ لاگ ان کریں",
|
|
12
|
+
"first-comment-person": "پہلا تبصرہ کرنے والا بنیں!",
|
|
13
|
+
"commented": "نے تبصرہ کیا",
|
|
14
|
+
"load-more": "مزید لوڈ کریں",
|
|
15
|
+
"counts": "%{counts} تبصرہ |||| %{counts} تبصرے",
|
|
16
|
+
"sort-asc": "سب سے پرانے سے ترتیب",
|
|
17
|
+
"sort-desc": "سب سے نئے سے ترتیب",
|
|
18
|
+
"logout": "لاگ آؤٹ",
|
|
19
|
+
"anonymous": "گمنام"
|
|
20
|
+
}
|
package/lib/interfaces/index.ts
CHANGED
|
@@ -4,14 +4,10 @@ import type FlipMove from "react-flip-move";
|
|
|
4
4
|
import type { Lang } from "../i18n";
|
|
5
5
|
import type { IssueCommentsQLResponse } from "../services/graphql/comment";
|
|
6
6
|
|
|
7
|
-
export interface GitalkProps
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
HTMLDivElement
|
|
12
|
-
>,
|
|
13
|
-
"id" | "title"
|
|
14
|
-
> {
|
|
7
|
+
export interface GitalkProps extends Omit<
|
|
8
|
+
React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
|
|
9
|
+
"id" | "title"
|
|
10
|
+
> {
|
|
15
11
|
/**
|
|
16
12
|
* GitHub Application Client ID.
|
|
17
13
|
*/
|
|
@@ -146,6 +142,12 @@ export interface GitalkProps
|
|
|
146
142
|
* Default collapse the comment if meets the height (px)
|
|
147
143
|
*/
|
|
148
144
|
collapsedHeight?: number;
|
|
145
|
+
/**
|
|
146
|
+
* Whether to highlight the comment created by admin users.
|
|
147
|
+
*
|
|
148
|
+
* @default true
|
|
149
|
+
*/
|
|
150
|
+
highlightAdminComment?: boolean;
|
|
149
151
|
/**
|
|
150
152
|
* Callback method invoked when updating the number of comments.
|
|
151
153
|
*
|