Skip to content

Commit 2738b18

Browse files
authored
feat: improve slug input UX and fix label layout (#6)
Add sample app buttons and fallback hint to AppSearch. Fix wrapping/overflow issues in LabelView and refine tooltip/layout spacing.
1 parent 712d70e commit 2738b18

2 files changed

Lines changed: 53 additions & 28 deletions

File tree

frontend/src/components/AppSearch.jsx

Lines changed: 45 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,53 @@ import { useState } from "react";
33
function AppSearch({ onSubmit, loading }) {
44
const [value, setValue] = useState("");
55

6+
const sampleApps = ["gitguardian", "octobox"];
7+
68
return (
7-
<form
8-
onSubmit={(e) => {
9-
e.preventDefault();
10-
onSubmit(value);
11-
}}
12-
className="mt-6 flex flex-col gap-2 sm:flex-row"
13-
>
14-
<input
15-
type="text"
16-
placeholder="GitHub App slug (e.g. gitguardian)"
17-
value={value}
18-
onChange={(e) => setValue(e.target.value)}
19-
className="w-full flex-1 rounded bg-white/10 px-3 py-2 text-sm text-white placeholder:text-gray-400 focus:outline-none focus:ring"
20-
/>
21-
<button
22-
type="submit"
23-
disabled={loading}
24-
className="w-full rounded bg-indigo-600 px-4 py-2 text-sm font-medium hover:bg-indigo-500 disabled:opacity-50 sm:w-auto"
9+
<div className="mt-6">
10+
<form
11+
onSubmit={(e) => {
12+
e.preventDefault();
13+
onSubmit(value);
14+
}}
15+
className="flex flex-col gap-2 sm:flex-row"
2516
>
26-
{loading ? "Inspecting…" : "Inspect"}
27-
</button>
28-
</form>
17+
<input
18+
type="text"
19+
placeholder="Enter a GitHub App slug"
20+
value={value}
21+
onChange={(e) => setValue(e.target.value)}
22+
className="w-full flex-1 rounded bg-white/10 px-3 py-2 text-sm text-white placeholder:text-gray-400 focus:outline-none focus:ring"
23+
/>
24+
25+
<button
26+
type="submit"
27+
disabled={loading}
28+
className="w-full rounded bg-indigo-600 px-4 py-2 text-sm font-medium hover:bg-indigo-500 disabled:opacity-50 sm:w-auto"
29+
>
30+
{loading ? "Inspecting…" : "Inspect"}
31+
</button>
32+
</form>
33+
34+
<div className="mt-3 flex flex-wrap items-center gap-2 text-xs text-gray-400">
35+
<span>Try:</span>
36+
37+
{sampleApps.map((app) => (
38+
<button
39+
key={app}
40+
type="button"
41+
onClick={() => setValue(app)}
42+
className="rounded bg-white/10 px-2 py-1 hover:bg-white/20 transition"
43+
>
44+
{app}
45+
</button>
46+
))}
47+
</div>
48+
49+
<p className="mt-2 text-xs text-gray-500">
50+
Unresolved slugs automatically fall back to the PermLens GitHub App.
51+
</p>
52+
</div>
2953
);
3054
}
3155

frontend/src/components/LabelView.jsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ function LabelView({ label, meta, slug }) {
2828
</div>
2929

3030
<div className="pointer-events-none absolute right-0 top-8 w-56 rounded bg-black/90 px-3 py-2 text-xs text-gray-200 opacity-0 shadow-lg transition-opacity group-hover:opacity-100">
31-
Showing a cached privacy label.<br />
32-
Cached {cacheMinutesAgo} minute{cacheMinutesAgo !== 1 && "s"} ago.
31+
Showing a cached privacy label.
32+
<br />
33+
Cached {cacheMinutesAgo} minute{cacheMinutesAgo !== 1 && "s"}{" "} ago.
3334
</div>
3435
</div>
3536
)}
@@ -56,7 +57,7 @@ function LabelView({ label, meta, slug }) {
5657
<header className="mb-6">
5758
<h2 className="text-lg font-semibold sm:text-xl">Privacy Label</h2>
5859
<div
59-
className={`mt-2 inline-flex items-center rounded px-3 py-1 text-sm font-medium ${styles}`}
60+
className={`mt-2 inline-flex max-w-full flex-wrap items-center rounded px-3 py-1 text-sm font-medium break-words ${styles}`}
6061
>
6162
Overall sensitivity: {label.overall_sensitivity}
6263
</div>
@@ -69,9 +70,9 @@ function LabelView({ label, meta, slug }) {
6970
<ul className="grid grid-cols-1 gap-3 sm:grid-cols-2 [@media(max-height:700px)]:grid-cols-2">
7071
{label.data_categories.map((cat) => (
7172
<li key={cat.key} className="rounded bg-black/30 p-3">
72-
<div className="flex items-center justify-between">
73-
<span className="font-medium">{cat.label}</span>
74-
<span className="text-xs text-gray-400">
73+
<div className="flex items-center justify-between gap-2">
74+
<span className="font-medium min-w-0">{cat.label}</span>
75+
<span className="text-xs text-gray-400 shrink-0">
7576
{cat.sensitivity}
7677
</span>
7778
</div>
@@ -102,4 +103,4 @@ function LabelView({ label, meta, slug }) {
102103
);
103104
}
104105

105-
export default LabelView;
106+
export default LabelView;

0 commit comments

Comments
 (0)