refactor(sidebar): mute diff stats and PR badge colors, add state label

- Reduce diff stat number brightness with muted green/red
- PR badge uses foregroundMuted by default, foreground on hover
- Show PR state label (Open/Merged/Closed) next to number
- Show external link icon on hover
This commit is contained in:
Mohamed Boudra
2026-03-22 21:07:43 +07:00
parent e2248015aa
commit 1f764d418c
@@ -30,6 +30,7 @@ import {
ChevronDown, ChevronDown,
ChevronRight, ChevronRight,
Copy, Copy,
ExternalLink,
FolderGit2, FolderGit2,
GitPullRequest, GitPullRequest,
Monitor, Monitor,
@@ -97,15 +98,10 @@ const workspaceKeyExtractor = (workspace: SidebarWorkspaceEntry) => workspace.wo
const projectKeyExtractor = (project: SidebarProjectEntry) => project.projectKey; const projectKeyExtractor = (project: SidebarProjectEntry) => project.projectKey;
const EMPTY_WORKSPACES = new Map(); const EMPTY_WORKSPACES = new Map();
const WORKSPACE_STATUS_DOT_WIDTH = 14; const WORKSPACE_STATUS_DOT_WIDTH = 14;
const GITHUB_PR_STATE_COLORS: Record<PrHint["state"], string> = { const GITHUB_PR_STATE_LABELS: Record<PrHint["state"], string> = {
open: "#3fb950", open: "Open",
merged: "#a371f7", merged: "Merged",
closed: "#f85149", closed: "Closed",
};
const GITHUB_PR_STATE_COLORS_HOVER: Record<PrHint["state"], string> = {
open: "#56d364",
merged: "#bc8cff",
closed: "#ff7b72",
}; };
interface SidebarWorkspaceListProps { interface SidebarWorkspaceListProps {
@@ -166,10 +162,9 @@ interface WorkspaceRowInnerProps {
} }
function WorkspacePrBadge({ hint }: { hint: PrHint }) { function WorkspacePrBadge({ hint }: { hint: PrHint }) {
const color = GITHUB_PR_STATE_COLORS[hint.state]; const { theme } = useUnistyles();
const hoverColor = GITHUB_PR_STATE_COLORS_HOVER[hint.state];
const [isHovered, setIsHovered] = useState(false); const [isHovered, setIsHovered] = useState(false);
const activeColor = isHovered ? hoverColor : color; const activeColor = isHovered ? theme.colors.foreground : theme.colors.foregroundMuted;
const handlePressIn = useCallback((event: GestureResponderEvent) => { const handlePressIn = useCallback((event: GestureResponderEvent) => {
event.stopPropagation(); event.stopPropagation();
@@ -202,12 +197,12 @@ function WorkspacePrBadge({ hint }: { hint: PrHint }) {
style={[ style={[
styles.workspacePrBadgeText, styles.workspacePrBadgeText,
{ color: activeColor }, { color: activeColor },
isHovered && styles.workspacePrBadgeTextHovered,
]} ]}
numberOfLines={1} numberOfLines={1}
> >
#{hint.number} #{hint.number} · {GITHUB_PR_STATE_LABELS[hint.state]}
</Text> </Text>
{isHovered && <ExternalLink size={10} color={activeColor} />}
</Pressable> </Pressable>
); );
} }
@@ -2221,9 +2216,6 @@ const styles = StyleSheet.create((theme) => ({
fontWeight: theme.fontWeight.normal, fontWeight: theme.fontWeight.normal,
lineHeight: 14, lineHeight: 14,
}, },
workspacePrBadgeTextHovered: {
textDecorationLine: "underline",
},
workspaceCreatingText: { workspaceCreatingText: {
color: theme.colors.foregroundMuted, color: theme.colors.foregroundMuted,
fontSize: theme.fontSize.xs, fontSize: theme.fontSize.xs,
@@ -2238,12 +2230,12 @@ const styles = StyleSheet.create((theme) => ({
diffStatAdditions: { diffStatAdditions: {
fontSize: theme.fontSize.xs, fontSize: theme.fontSize.xs,
fontWeight: theme.fontWeight.normal, fontWeight: theme.fontWeight.normal,
color: theme.colors.palette.green[400], color: "#2d8a4e",
}, },
diffStatDeletions: { diffStatDeletions: {
fontSize: theme.fontSize.xs, fontSize: theme.fontSize.xs,
fontWeight: theme.fontWeight.normal, fontWeight: theme.fontWeight.normal,
color: theme.colors.palette.red[500], color: "#c43a31",
}, },
kebabButton: { kebabButton: {
padding: 2, padding: 2,