gitalk-react 1.0.0 → 1.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.
Files changed (63) hide show
  1. package/README-zh-CN.md +152 -53
  2. package/README.md +132 -34
  3. package/dist/gitalk-dark.css +1 -1
  4. package/dist/gitalk-light.css +1 -1
  5. package/dist/gitalk.browser.full.js +102 -0
  6. package/dist/gitalk.browser.js +94 -0
  7. package/dist/gitalk.cjs +94 -0
  8. package/dist/gitalk.d.cts +14 -0
  9. package/dist/gitalk.d.mts +174 -0
  10. package/dist/gitalk.js +2737 -10382
  11. package/package.json +61 -41
  12. package/proxy-server/.env.example +6 -0
  13. package/proxy-server/README.md +38 -0
  14. package/proxy-server/server.mjs +110 -0
  15. package/dist/gitalk.d.ts +0 -623
  16. package/dist/gitalk.umd.cjs +0 -126
  17. package/lib/assets/arrow-down.svg +0 -1
  18. package/lib/assets/edit.svg +0 -3
  19. package/lib/assets/github.svg +0 -3
  20. package/lib/assets/heart-filled.svg +0 -3
  21. package/lib/assets/heart.svg +0 -3
  22. package/lib/assets/reply.svg +0 -3
  23. package/lib/assets/tip.svg +0 -8
  24. package/lib/components/action.tsx +0 -21
  25. package/lib/components/avatar.tsx +0 -42
  26. package/lib/components/button.tsx +0 -35
  27. package/lib/components/comment-textarea.tsx +0 -166
  28. package/lib/components/comment.tsx +0 -204
  29. package/lib/components/comments-list.tsx +0 -112
  30. package/lib/components/meta.tsx +0 -133
  31. package/lib/components/svg.tsx +0 -29
  32. package/lib/constants/index.ts +0 -71
  33. package/lib/contexts/I18nContext.ts +0 -20
  34. package/lib/gitalk.tsx +0 -891
  35. package/lib/i18n/ar.json +0 -20
  36. package/lib/i18n/bn.json +0 -20
  37. package/lib/i18n/de.json +0 -20
  38. package/lib/i18n/en.json +0 -20
  39. package/lib/i18n/es.json +0 -20
  40. package/lib/i18n/fa.json +0 -20
  41. package/lib/i18n/fr.json +0 -20
  42. package/lib/i18n/hi.json +0 -20
  43. package/lib/i18n/index.ts +0 -53
  44. package/lib/i18n/ja.json +0 -20
  45. package/lib/i18n/ko.json +0 -20
  46. package/lib/i18n/pl.json +0 -21
  47. package/lib/i18n/pt.json +0 -20
  48. package/lib/i18n/ru.json +0 -20
  49. package/lib/i18n/ur.json +0 -20
  50. package/lib/i18n/zh-CN.json +0 -20
  51. package/lib/i18n/zh-TW.json +0 -20
  52. package/lib/interfaces/index.ts +0 -198
  53. package/lib/services/graphql/comment.ts +0 -84
  54. package/lib/services/request.ts +0 -24
  55. package/lib/services/user.ts +0 -40
  56. package/lib/themes/base.scss +0 -630
  57. package/lib/themes/gitalk-dark.scss +0 -28
  58. package/lib/themes/gitalk-light.scss +0 -28
  59. package/lib/utils/compatibility.ts +0 -35
  60. package/lib/utils/dom.ts +0 -15
  61. package/lib/utils/logger.ts +0 -66
  62. package/lib/utils/query.ts +0 -19
  63. package/lib/vite-env.d.ts +0 -1
package/lib/i18n/ar.json DELETED
@@ -1,20 +0,0 @@
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 DELETED
@@ -1,20 +0,0 @@
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/de.json DELETED
@@ -1,20 +0,0 @@
1
- {
2
- "init": "Gitalking ...",
3
- "no-found-related": "Zugehöriger %{link} nicht gefunden",
4
- "please-contact": "Bitte kontaktiere %{user} um den Kommentar zu initialisieren",
5
- "init-issue": "Initialisiere Issue",
6
- "leave-a-comment": "Hinterlasse einen Kommentar",
7
- "preview": "Vorschau",
8
- "edit": "Editieren",
9
- "comment": "Kommentieren",
10
- "support-markdown": "Markdown wird unterstützt",
11
- "login-with-github": "Mit GitHub-Account anmelden",
12
- "first-comment-person": "Sei die erste Person, welche einen Kommentar hinterlässt!",
13
- "commented": "kommentierte",
14
- "load-more": "Zeige mehr",
15
- "counts": "%{counts} Kommentar |||| %{counts} Kommentare",
16
- "sort-asc": "Älteste zuerst",
17
- "sort-desc": "Neuste zuerst",
18
- "logout": "Abmelden",
19
- "anonymous": "Anonym"
20
- }
package/lib/i18n/en.json DELETED
@@ -1,20 +0,0 @@
1
- {
2
- "init": "Gitalking ...",
3
- "no-found-related": "Related %{link} not found",
4
- "please-contact": "Please contact %{user} to initialize the comment",
5
- "init-issue": "Init Issue",
6
- "leave-a-comment": "Leave a comment",
7
- "preview": "Preview",
8
- "edit": "Edit",
9
- "comment": "Comment",
10
- "support-markdown": "Markdown is supported",
11
- "login-with-github": "Login with GitHub",
12
- "first-comment-person": "Be the first person to leave a comment!",
13
- "commented": "commented",
14
- "load-more": "Load more",
15
- "counts": "%{counts} comment |||| %{counts} comments",
16
- "sort-asc": "Sort by Oldest",
17
- "sort-desc": "Sort by Latest",
18
- "logout": "Logout",
19
- "anonymous": "Anonymous"
20
- }
package/lib/i18n/es.json DELETED
@@ -1,20 +0,0 @@
1
- {
2
- "init": "Gitalking ...",
3
- "no-found-related": "Link %{link} no encontrado",
4
- "please-contact": "Por favor contacta con %{user} para inicializar el comentario",
5
- "init-issue": "Iniciar Issue",
6
- "leave-a-comment": "Deja un comentario",
7
- "preview": "Avance",
8
- "edit": "Editar",
9
- "comment": "Comentario",
10
- "support-markdown": "Markdown es soportado",
11
- "login-with-github": "Entrar con GitHub",
12
- "first-comment-person": "Sé el primero en dejar un comentario!",
13
- "commented": "comentó",
14
- "load-more": "Cargar más",
15
- "counts": "%{counts} comentario |||| %{counts} comentarios",
16
- "sort-asc": "Ordenar por Antiguos",
17
- "sort-desc": "Ordenar por Recientes",
18
- "logout": "Salir",
19
- "anonymous": "Anónimo"
20
- }
package/lib/i18n/fa.json DELETED
@@ -1,20 +0,0 @@
1
- {
2
- "init": "بارگزاری ...",
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": "پشتیبانی از مارک‌داون",
11
- "login-with-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/fr.json DELETED
@@ -1,20 +0,0 @@
1
- {
2
- "init": "Gitalking ...",
3
- "no-found-related": "Lien %{link} non trouvé",
4
- "please-contact": "Veuillez contacter %{user} pour initialiser les commentaires",
5
- "init-issue": "Initialisation des issues",
6
- "leave-a-comment": "Laisser un commentaire",
7
- "preview": "Aperçu",
8
- "edit": "Modifier",
9
- "comment": "Commentaire",
10
- "support-markdown": "Markdown est supporté",
11
- "login-with-github": "Se connecter avec GitHub",
12
- "first-comment-person": "Soyez le premier à laisser un commentaire !",
13
- "commented": "a commenté",
14
- "load-more": "Charger plus",
15
- "counts": "%{counts} commentaire |||| %{counts} commentaires",
16
- "sort-asc": "Trier du plus ancien au plus récent",
17
- "sort-desc": "Trier du plus récent au plus ancien",
18
- "logout": "Déconnexion",
19
- "anonymous": "Anonyme"
20
- }
package/lib/i18n/hi.json DELETED
@@ -1,20 +0,0 @@
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 DELETED
@@ -1,53 +0,0 @@
1
- import Polyglot from "node-polyglot";
2
-
3
- import { DEFAULT_LANG } from "../constants";
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";
20
-
21
- export const i18nMap = {
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,
42
- };
43
-
44
- export type Lang = keyof typeof i18nMap;
45
-
46
- const getPolyglotInstance = (lang: Lang = DEFAULT_LANG) => {
47
- return new Polyglot({
48
- phrases: i18nMap[lang] ?? i18nMap.en,
49
- locale: lang,
50
- });
51
- };
52
-
53
- export default getPolyglotInstance;
package/lib/i18n/ja.json DELETED
@@ -1,20 +0,0 @@
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/ko.json DELETED
@@ -1,20 +0,0 @@
1
- {
2
- "init": "초기화 중 ...",
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/pl.json DELETED
@@ -1,21 +0,0 @@
1
- {
2
- "init": "Gitalking ...",
3
- "no-found-related": "Nie znaleziono powiązanego zgłoszenia: %{link}",
4
- "please-contact": "Skontaktuj się z %{user}, aby umożliwić komentowanie",
5
- "init-issue": "Utwórz zgłoszenie (GitHub Issue)",
6
- "leave-a-comment": "Skomentuj",
7
- "preview": "Podgląd",
8
- "edit": "Edytuj",
9
- "comment": "Wyślij",
10
- "support-markdown": "Możesz użyć składni Markdown",
11
- "login-with-github": "Zaloguj się poprzez GitHub",
12
- "first-comment-person": "Skomentuj jako pierwszy!",
13
- "commented": "skomentowany",
14
- "load-more": "Załaduj więcej",
15
- "counts": "%{counts} komentarz |||| %{counts} komentarze |||| %{counts} komentarzy",
16
- "sort-asc": "Sortuj od najstarszych",
17
- "sort-desc": "Sortuj od najnowszych",
18
- "logout": "Wyloguj",
19
- "anonymous": "Anonimowy"
20
- }
21
-
package/lib/i18n/pt.json DELETED
@@ -1,20 +0,0 @@
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/ru.json DELETED
@@ -1,20 +0,0 @@
1
- {
2
- "init": "Gitalking ...",
3
- "no-found-related": "Связанные %{link} не найдены",
4
- "please-contact": "Пожалуйста, свяжитесь с %{user} чтобы инициализировать комментарий",
5
- "init-issue": "Выпуск инициализации",
6
- "leave-a-comment": "Оставить комментарий",
7
- "preview": "Предварительный просмотр",
8
- "edit": "Pедактировать",
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/ur.json DELETED
@@ -1,20 +0,0 @@
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
- }
@@ -1,20 +0,0 @@
1
- {
2
- "init": "Gitalk 加载中 ...",
3
- "no-found-related": "未找到相关的 %{link} 进行评论",
4
- "please-contact": "请联系 %{user} 初始化创建",
5
- "init-issue": "初始化 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
- }
@@ -1,20 +0,0 @@
1
- {
2
- "init": "Gitalk 載入中…",
3
- "no-found-related": "未找到相關的 %{link}",
4
- "please-contact": "請聯絡 %{user} 初始化評論",
5
- "init-issue": "初始化 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
- }
@@ -1,198 +0,0 @@
1
- import type { Endpoints } from "@octokit/types";
2
- import type FlipMove from "react-flip-move";
3
-
4
- import type { Lang } from "../i18n";
5
- import type { IssueCommentsQLResponse } from "../services/graphql/comment";
6
-
7
- export interface GitalkProps extends Omit<
8
- React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
9
- "id" | "title"
10
- > {
11
- /**
12
- * GitHub Application Client ID.
13
- */
14
- clientID: string;
15
- /**
16
- * GitHub Application Client Secret.
17
- */
18
- clientSecret: string;
19
- /**
20
- * GitHub repository owner.
21
- * Can be personal user or organization.
22
- */
23
- owner: string;
24
- /**
25
- * Name of Github repository.
26
- */
27
- repo: string;
28
- /**
29
- * GitHub repository owner and collaborators.
30
- * (Users who having write access to this repository)
31
- */
32
- admin: string[];
33
- /**
34
- * The unique id of the page.
35
- * Length must less than 50.
36
- *
37
- * @default location.host + location.pathname
38
- */
39
- id?: string;
40
- /**
41
- * The issue ID of the page.
42
- * If the number attribute is not defined, issue will be located using id.
43
- */
44
- number?: number;
45
- /**
46
- * GitHub issue labels.
47
- *
48
- * @default ['Gitalk']
49
- */
50
- labels?: string[];
51
- /**
52
- * GitHub issue title.
53
- *
54
- * @default document.title
55
- */
56
- title?: string;
57
- /**
58
- * GitHub issue body.
59
- *
60
- * @default location.href + header.meta[description]
61
- */
62
- body?: string;
63
- /**
64
- * Localization language key.
65
- *
66
- * @default navigator.language
67
- */
68
- language?: Lang;
69
- /**
70
- * Pagination size, with maximum 100.
71
- *
72
- * @default 10
73
- */
74
- perPage?: number;
75
- /**
76
- * Comment sorting direction.
77
- * Available values are `last` and `first`.
78
- *
79
- * @default "last"
80
- */
81
- pagerDirection?: "last" | "first";
82
- /**
83
- * By default, Gitalk will create a corresponding github issue for your every single page automatically when the logined user is belong to the admin users.
84
- * You can create it manually by setting this option to true.
85
- *
86
- * @default false
87
- */
88
- createIssueManually?: boolean;
89
- /**
90
- * Enable hot key (cmd|ctrl + enter) submit comment.
91
- *
92
- * @default true
93
- */
94
- enableHotKey?: boolean;
95
- /**
96
- * Facebook-like distraction free mode.
97
- *
98
- * @default false
99
- */
100
- distractionFreeMode?: boolean;
101
- /**
102
- * Comment list animation.
103
- *
104
- * @default
105
- * ```ts
106
- * {
107
- * staggerDelayBy: 150,
108
- * appearAnimation: 'accordionVertical',
109
- * enterAnimation: 'accordionVertical',
110
- * leaveAnimation: 'accordionVertical',
111
- * }
112
- * ```
113
- * @link https://github.com/joshwcomeau/react-flip-move/blob/master/documentation/enter_leave_animations.md
114
- */
115
- flipMoveOptions?: FlipMove.FlipMoveProps;
116
- /**
117
- * GitHub oauth request reverse proxy for CORS.
118
- * [Why need this?](https://github.com/isaacs/github/issues/330)
119
- *
120
- * @default "https://cors-anywhere.azm.workers.dev/https://github.com/login/oauth/access_token"
121
- */
122
- proxy?: string;
123
- /**
124
- * Default user field if comments' author is not provided
125
- *
126
- * @default
127
- * ```ts
128
- * {
129
- * avatar_url: "//avatars1.githubusercontent.com/u/29697133?s=50",
130
- * login: "null",
131
- * html_url: ""
132
- * }
133
- */
134
- defaultUser?: Comment["user"];
135
- /**
136
- * Default user field if comments' author is not provided
137
- *
138
- * @deprecated use `defaultUser`
139
- */
140
- defaultAuthor?: IssueCommentsQLResponse["repository"]["issue"]["comments"]["nodes"][number]["author"];
141
- /**
142
- * Default collapse the comment if meets the height (px)
143
- */
144
- collapsedHeight?: number;
145
- /**
146
- * Whether to highlight the comment created by admin users.
147
- *
148
- * @default true
149
- */
150
- highlightAdminComment?: boolean;
151
- /**
152
- * Callback method invoked when updating the number of comments.
153
- *
154
- * @param count comments number
155
- */
156
- updateCountCallback?: (count: number) => void;
157
- /**
158
- * Callback method invoked when a new issue is successfully created.
159
- *
160
- * @param issue created issue
161
- */
162
- onCreateIssue?: (issue: Issue) => void;
163
- /**
164
- * Callback method invoked when a new comment is successfully created.
165
- *
166
- * @param comment created comment
167
- */
168
- onCreateComment?: (comment: Comment) => void;
169
- }
170
-
171
- export type User = Endpoints["GET /user"]["response"]["data"];
172
-
173
- export type Issue =
174
- Endpoints["GET /repos/{owner}/{repo}/issues/{issue_number}"]["response"]["data"];
175
-
176
- type CommentDefine =
177
- Endpoints["GET /repos/{owner}/{repo}/issues/{issue_number}/comments"]["response"]["data"][number];
178
-
179
- export type Comment = Pick<
180
- CommentDefine,
181
- "id" | "body" | "body_html" | "created_at" | "html_url"
182
- > & {
183
- user: Pick<
184
- NonNullable<CommentDefine["user"]>,
185
- "avatar_url" | "login" | "html_url"
186
- >;
187
- reactions: Pick<NonNullable<CommentDefine["reactions"]>, "heart">;
188
- reactionsHeart: {
189
- totalCount: number;
190
- viewerHasReacted: boolean;
191
- nodes: {
192
- databaseId: number;
193
- user: {
194
- login: string;
195
- };
196
- }[];
197
- };
198
- };