Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

feat: "LTGM" message when no errors are found

Elijah Potterd366cb4967c5
diff --git a/src/harper/LintList.tsx b/src/harper/LintList.tsx
index 8c06306f3..95026c89c 100644
--- a/src/harper/LintList.tsx
+++ b/src/harper/LintList.tsx
@@ -1,8 +1,27 @@
import React from 'react';
import { LintBox } from './Box';
import LintListItem from './LintListItem';
+import { Animate } from '@wordpress/components';
export default function LintList({ lintBoxes }: { lintBoxes: LintBox[] }) {
+ if (lintBoxes.length === 0) {
+ return (
+ <div className="harper-solved-cont">
+ <Animate type="slide-in">
+ {({ className }) => (
+ <div className={className ?? ''}>
+ <h2>LGTM 👍</h2>
+ <p>
+ Harper could not find any problems with your
+ work.
+ </p>
+ </div>
+ )}
+ </Animate>
+ </div>
+ );
+ }
+
return (
<>
{lintBoxes
diff --git a/src/harper/index.css b/src/harper/index.css
index a195ff5a9..f6f25e4f9 100644
--- a/src/harper/index.css
+++ b/src/harper/index.css
@@ -4,6 +4,23 @@
padding: 10px;
}
+.harper-solved-cont {
+ padding: 35px;
+ width: 100%;
+ display: flex;
+ flex-direction: row;
+ justify-content: center;
+}
+
+.harper-solved-cont h2 {
+ font-size: 20px;
+ font-weight: bold;
+}
+
+.harper-solved-cont p {
+ font-size: 16px;
+}
+
.harper-lint-card {
margin: 4px;
}
diff --git a/src/harper/lintUtils.ts b/src/harper/lintUtils.ts
index 106bf3792..5676f8611 100644
--- a/src/harper/lintUtils.ts
+++ b/src/harper/lintUtils.ts
@@ -1,5 +1,11 @@
import { SuggestionKind } from 'harper.js';
+/**
+ * Produce the UI text shown inside suggestion buttons.
+ * @param kind
+ * @param problemText
+ * @param replacementText
+ */
export function suggestionText(
kind: SuggestionKind,
problemText: string,