Show a one-time GitHub star prompt after a task first reaches done. - detect task status transitions into done and trigger the prompt only in project view - add a dismissible GitHub star prompt component plus localStorage-backed persistence hook - cover the new prompt behavior with component, hook, and transition helper tests - document the prompt behavior and styling guidance in the dashboard guide Files changed: docs/dashboard-guide.md | 3 + packages/dashboard/app/App.tsx | 21 +++++- .../dashboard/app/components/GitHubStarPrompt.css | 76 ++++++++++++++++++++++ .../dashboard/app/components/GitHubStarPrompt.tsx | 53 +++++++++++++++ .../app/components/__tests__/App.test.tsx | 12 +++- .../components/__tests__/GitHubStarPrompt.test.tsx | 40 ++++++++++++ .../hooks/__tests__/useGitHubStarPrompt.test.ts | 64 ++++++++++++++++++ .../dashboard/app/hooks/useGitHubStarPrompt.ts | 46 +++++++++++++ 8 files changed, 313 insertions(+), 2 deletions(-) Fusion-Task-Id: FN-5967 Fusion-Task-Lineage: 5fffdf4d-61d8-4ac8-bcf4-8b453b639b28
54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
import { Star, X } from "lucide-react";
|
|
import "./GitHubStarPrompt.css";
|
|
|
|
const GITHUB_REPO_URL = "https://github.com/Runfusion/Fusion";
|
|
|
|
interface GitHubStarPromptProps {
|
|
onStar?: () => void;
|
|
onDismiss: () => void;
|
|
}
|
|
|
|
export function GitHubStarPrompt({ onStar, onDismiss }: GitHubStarPromptProps) {
|
|
const handleStar = () => {
|
|
onStar?.();
|
|
onDismiss();
|
|
};
|
|
|
|
return (
|
|
<section className="card github-star-prompt" role="region" aria-live="polite" aria-label="GitHub star prompt">
|
|
<div className="github-star-prompt__header">
|
|
<div className="github-star-prompt__title-wrap">
|
|
<Star aria-hidden="true" />
|
|
<h3>Enjoying Fusion?</h3>
|
|
</div>
|
|
<button
|
|
type="button"
|
|
className="btn-icon github-star-prompt__dismiss"
|
|
onClick={onDismiss}
|
|
aria-label="Dismiss GitHub star prompt"
|
|
>
|
|
<X aria-hidden="true" />
|
|
</button>
|
|
</div>
|
|
<p>
|
|
If Fusion has saved you time, a GitHub star goes a long way. It helps other developers discover the
|
|
project and keeps the team motivated to ship improvements.
|
|
</p>
|
|
<div className="github-star-prompt__actions">
|
|
<a
|
|
className="btn btn-sm github-star-prompt__cta"
|
|
href={GITHUB_REPO_URL}
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
onClick={handleStar}
|
|
>
|
|
<Star aria-hidden="true" />
|
|
<span>Star on GitHub</span>
|
|
</a>
|
|
</div>
|
|
</section>
|
|
);
|
|
}
|
|
|
|
export { GITHUB_REPO_URL };
|