Skip to content

Commit c925866

Browse files
authored
Merge pull request #11 from Petrus-Han/main
Feat: Enhance diff modal with 'Diff Only' toggle and update .gitignore
2 parents 76cfce7 + 85bdd9d commit c925866

File tree

3 files changed

+74
-20
lines changed

3 files changed

+74
-20
lines changed

.gitignore

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,47 @@
11
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
22

33
# dependencies
4-
/node_modules
4+
node_modules/
55
/.pnp
6-
.pnp.js
6+
.pnp.*
7+
.yarn/*
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/versions
12+
13+
# lock files
14+
yarn.lock
15+
package-lock.json
16+
pnpm-lock.yaml
717

818
# testing
919
/coverage
1020

1121
# next.js
12-
/.next/
22+
.next/
1323
/out/
24+
.cache/
1425

1526
# production
1627
/build
28+
/dist
1729

1830
# misc
1931
.DS_Store
2032
*.pem
33+
*.log
34+
Thumbs.db
2135

2236
# debug
2337
npm-debug.log*
2438
yarn-debug.log*
2539
yarn-error.log*
40+
.pnpm-debug.log*
2641

2742
# local env files
2843
.env*
44+
!.env.example
2945
!*/.env.example
3046

3147
# vercel
@@ -34,3 +50,9 @@ yarn-error.log*
3450
# typescript
3551
*.tsbuildinfo
3652
next-env.d.ts
53+
54+
# IDE
55+
.idea/
56+
*.swp
57+
*.swo
58+
*~

dify-helm-watchdog/.gitignore

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
22

33
# dependencies
4-
/node_modules
4+
node_modules/
55
/.pnp
66
.pnp.*
77
.yarn/*
@@ -10,6 +10,11 @@
1010
!.yarn/releases
1111
!.yarn/versions
1212

13+
# lock files
14+
yarn.lock
15+
package-lock.json
16+
pnpm-lock.yaml
17+
1318
# testing
1419
/coverage
1520

@@ -20,10 +25,13 @@
2025

2126
# production
2227
/build
28+
/dist
2329

2430
# misc
2531
.DS_Store
2632
*.pem
33+
*.log
34+
Thumbs.db
2735

2836
# debug
2937
npm-debug.log*
@@ -34,11 +42,16 @@ yarn-error.log*
3442
# env files (can opt-in for committing if needed)
3543
.env*
3644
!.env.example
37-
.env.local
3845

3946
# vercel
4047
.vercel
4148

4249
# typescript
4350
*.tsbuildinfo
4451
next-env.d.ts
52+
53+
# IDE
54+
.idea/
55+
*.swp
56+
*.swo
57+
*~

dify-helm-watchdog/src/components/modals/diff-comparison-modal.tsx

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22

3-
import { useEffect } from "react";
4-
import { Loader2, X } from "lucide-react";
3+
import { useEffect, useState } from "react";
4+
import { Loader2, X, Filter } from "lucide-react";
55
import { motion } from "framer-motion";
66
import ReactDiffViewer from "react-diff-viewer";
77
import type { ReactDiffViewerStylesOverride } from "react-diff-viewer";
@@ -38,6 +38,8 @@ export default function DiffComparisonModal({
3838
isLoading,
3939
error,
4040
}: DiffComparisonModalProps) {
41+
const [showDiffOnly, setShowDiffOnly] = useState(false);
42+
4143
// ESC key handler
4244
useEffect(() => {
4345
if (!isOpen) {
@@ -106,9 +108,9 @@ export default function DiffComparisonModal({
106108
</p>
107109
</header>
108110

109-
{/* Tabs */}
110-
<div className="flex items-center justify-center gap-4">
111-
<div className="relative flex w-full justify-center rounded-full border border-border bg-muted p-1">
111+
{/* Tabs and Filter Toggle */}
112+
<div className="flex items-center gap-4">
113+
<div className="relative flex flex-[9] justify-center rounded-full border border-border bg-muted p-1 min-w-0">
112114
{tabs.map((tab) => {
113115
const isActive = tab.id === activeTabId;
114116
return (
@@ -138,6 +140,21 @@ export default function DiffComparisonModal({
138140
);
139141
})}
140142
</div>
143+
<motion.button
144+
type="button"
145+
onClick={() => setShowDiffOnly((prev) => !prev)}
146+
whileHover={{ scale: 1.05 }}
147+
whileTap={{ scale: 0.95 }}
148+
className={`inline-flex items-center gap-2 rounded-full border px-4 py-2 text-xs font-semibold uppercase tracking-[0.25em] transition-colors whitespace-nowrap shrink-0 flex-[1] justify-center ${
149+
showDiffOnly
150+
? "border-primary bg-primary text-primary-foreground"
151+
: "border-border bg-muted text-muted-foreground hover:border-accent hover:bg-accent/10 hover:text-foreground"
152+
}`}
153+
aria-label={showDiffOnly ? "Show all lines" : "Show diff only"}
154+
>
155+
<Filter className="h-3.5 w-3.5" />
156+
<span>Diff Only</span>
157+
</motion.button>
141158
</div>
142159

143160
{/* Error message */}
@@ -163,16 +180,18 @@ export default function DiffComparisonModal({
163180
<div
164181
className="custom-scrollbar flex-1 overflow-auto rounded-xl bg-muted p-4 max-h-[calc(95vh-200px)]"
165182
>
166-
<ReactDiffViewer
167-
oldValue={diffContent.oldValue}
168-
newValue={diffContent.newValue}
169-
splitView
170-
styles={diffViewerStyles}
171-
useDarkTheme={theme === "dark"}
172-
showDiffOnly={false}
173-
leftTitle={`v${targetVersion}`}
174-
rightTitle={`v${baseVersion}`}
175-
/>
183+
<div className="min-w-fit">
184+
<ReactDiffViewer
185+
oldValue={diffContent.oldValue}
186+
newValue={diffContent.newValue}
187+
splitView
188+
styles={diffViewerStyles}
189+
useDarkTheme={theme === "dark"}
190+
showDiffOnly={showDiffOnly}
191+
leftTitle={`v${targetVersion}`}
192+
rightTitle={`v${baseVersion}`}
193+
/>
194+
</div>
176195
</div>
177196
</div>
178197
</motion.div>

0 commit comments

Comments
 (0)