From ded41a63a16e5cbc57c92873db7c32bd2291068d Mon Sep 17 00:00:00 2001
From: Bhathiya Vicum
Date: Fri, 24 Apr 2026 10:16:00 +0530
Subject: [PATCH 1/4] feat: always show Swap/Reset buttons and disable when
inputs are empty
---
components/compare-form.tsx | 41 +++++++++++++++++--------------------
1 file changed, 19 insertions(+), 22 deletions(-)
diff --git a/components/compare-form.tsx b/components/compare-form.tsx
index cc79df4..56c4d5a 100644
--- a/components/compare-form.tsx
+++ b/components/compare-form.tsx
@@ -39,6 +39,7 @@ export function CompareForm({
}, []);
const canSubmit = Boolean(username1.trim() && username2.trim() && !loading);
+ const isEmpty = !username1.trim() && !username2.trim();
const handleSwap = () => {
setUsername1(username2);
@@ -90,28 +91,24 @@ export function CompareForm({
>
{loading ? t("form.compare.ing") : t("form.compare")}
- {data && (
- <>
-
-
- >
- )}
+
+
{error && (
From 0e1a36692a06af345996f04f331e4766c17925ca Mon Sep 17 00:00:00 2001
From: Bhathiya Vicum
Date: Sat, 25 Apr 2026 10:28:23 +0530
Subject: [PATCH 2/4] refactor: extract GitHub link into reusable component and
remove Icon
Co-authored-by: Copilot
---
components/app-footer.tsx | 17 ++---------------
components/github-link.tsx | 24 ++++++++++++++++++++++++
components/theme-toggle.tsx | 18 +++---------------
components/ui/button.tsx | 11 +----------
4 files changed, 30 insertions(+), 40 deletions(-)
create mode 100644 components/github-link.tsx
diff --git a/components/app-footer.tsx b/components/app-footer.tsx
index 95c1c47..63ea598 100644
--- a/components/app-footer.tsx
+++ b/components/app-footer.tsx
@@ -2,8 +2,7 @@
import { useTranslation } from "@/components/language-provider";
import { cn } from "@/lib/utils";
-import { Icon } from "./ui/button";
-import { FaGithub } from "react-icons/fa";
+import { GithubLink } from "./github-link";
export function AppFooter() {
const { t, dir } = useTranslation();
@@ -57,19 +56,7 @@ export function AppFooter() {
>
{t("footer.note")}
-
-
-
-
-
+
diff --git a/components/github-link.tsx b/components/github-link.tsx
new file mode 100644
index 0000000..22ff1fb
--- /dev/null
+++ b/components/github-link.tsx
@@ -0,0 +1,24 @@
+"use client";
+
+import { Button } from "./ui/button";
+import { FaGithub } from "react-icons/fa";
+
+export function GithubLink() {
+ return (
+
+
+
+ );
+}
\ No newline at end of file
diff --git a/components/theme-toggle.tsx b/components/theme-toggle.tsx
index 3d47fd9..6a2cab1 100644
--- a/components/theme-toggle.tsx
+++ b/components/theme-toggle.tsx
@@ -2,10 +2,10 @@
import { Moon, Sun } from "lucide-react";
import { useTheme } from "next-themes";
-import { Button, Icon } from "./ui/button";
import { useSyncExternalStore } from "react";
import { useTranslation } from "./language-provider";
-import { FaGithub } from "react-icons/fa";
+import { Button } from "./ui/button";
+import { GithubLink } from "./github-link";
const emptySubscribe = () => () => { };
@@ -44,19 +44,7 @@ export function ThemeToggle() {
>
{mounted && current === "dark" ? : }
-
-
-
-
-
+
diff --git a/components/ui/button.tsx b/components/ui/button.tsx
index 8cf0297..bec75c3 100644
--- a/components/ui/button.tsx
+++ b/components/ui/button.tsx
@@ -37,13 +37,4 @@ export function Button({ className, variant, size, ...props }: ButtonProps) {
{...props}
/>
);
-}
-
-export function Icon({ className, variant, size, ...props }: ButtonProps) {
- return (
-
- );
-}
+}
\ No newline at end of file
From 5b2ba76505b1a0816539b15d63350c964850613f Mon Sep 17 00:00:00 2001
From: Bhathiya Vicum
Date: Sun, 26 Apr 2026 09:19:17 +0530
Subject: [PATCH 3/4] fix: enable swap and reset buttons when data is present
---
components/compare-form.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/components/compare-form.tsx b/components/compare-form.tsx
index 56c4d5a..ef9e3ca 100644
--- a/components/compare-form.tsx
+++ b/components/compare-form.tsx
@@ -94,7 +94,7 @@ export function CompareForm({