feat(app): label sidebar add project action
This commit is contained in:
@@ -341,6 +341,64 @@ function FooterIconButton({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function footerAddProjectButtonStyle({
|
||||||
|
hovered,
|
||||||
|
}: PressableStateCallbackType & { hovered?: boolean }) {
|
||||||
|
return [styles.footerAddProjectButton, Boolean(hovered) && styles.footerAddProjectButtonHovered];
|
||||||
|
}
|
||||||
|
|
||||||
|
function FooterAddProjectButton({
|
||||||
|
onPress,
|
||||||
|
label,
|
||||||
|
shortcutKeys,
|
||||||
|
theme,
|
||||||
|
}: {
|
||||||
|
onPress: () => void;
|
||||||
|
label: string;
|
||||||
|
shortcutKeys: ReturnType<typeof useShortcutKeys>;
|
||||||
|
theme: SidebarTheme;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<Tooltip delayDuration={300}>
|
||||||
|
<TooltipTrigger asChild>
|
||||||
|
<Pressable
|
||||||
|
style={footerAddProjectButtonStyle}
|
||||||
|
testID="sidebar-add-project"
|
||||||
|
nativeID="sidebar-add-project"
|
||||||
|
accessible
|
||||||
|
accessibilityLabel={label}
|
||||||
|
accessibilityRole="button"
|
||||||
|
onPress={onPress}
|
||||||
|
>
|
||||||
|
{({ hovered }) => {
|
||||||
|
const isHovered = Boolean(hovered);
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<FolderPlus
|
||||||
|
size={theme.iconSize.sm}
|
||||||
|
color={isHovered ? theme.colors.foreground : theme.colors.foregroundMuted}
|
||||||
|
/>
|
||||||
|
<Text
|
||||||
|
numberOfLines={1}
|
||||||
|
style={[
|
||||||
|
styles.footerAddProjectLabel,
|
||||||
|
isHovered && styles.footerAddProjectLabelHovered,
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
{label}
|
||||||
|
</Text>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
</Pressable>
|
||||||
|
</TooltipTrigger>
|
||||||
|
<TooltipContent side="top" align="center" offset={8}>
|
||||||
|
<IconTooltipContent label={label} shortcutKeys={shortcutKeys} />
|
||||||
|
</TooltipContent>
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function SidebarHostPicker({
|
function SidebarHostPicker({
|
||||||
theme,
|
theme,
|
||||||
label,
|
label,
|
||||||
@@ -494,6 +552,12 @@ function SidebarFooter({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.sidebarFooter}>
|
<View style={styles.sidebarFooter}>
|
||||||
|
<FooterAddProjectButton
|
||||||
|
onPress={handleOpenProject}
|
||||||
|
label={labels.addProject}
|
||||||
|
shortcutKeys={newAgentKeys}
|
||||||
|
theme={theme}
|
||||||
|
/>
|
||||||
<View style={styles.footerIconRow}>
|
<View style={styles.footerIconRow}>
|
||||||
<SidebarHostPicker
|
<SidebarHostPicker
|
||||||
theme={theme}
|
theme={theme}
|
||||||
@@ -501,14 +565,6 @@ function SidebarFooter({
|
|||||||
onAddHost={handleAddHost}
|
onAddHost={handleAddHost}
|
||||||
onOpenHostSettings={handleOpenHostSettings}
|
onOpenHostSettings={handleOpenHostSettings}
|
||||||
/>
|
/>
|
||||||
<FooterIconButton
|
|
||||||
onPress={handleOpenProject}
|
|
||||||
testID="sidebar-add-project"
|
|
||||||
label={labels.addProject}
|
|
||||||
icon={FolderPlus}
|
|
||||||
shortcutKeys={newAgentKeys}
|
|
||||||
theme={theme}
|
|
||||||
/>
|
|
||||||
<FooterIconButton
|
<FooterIconButton
|
||||||
onPress={handleHome}
|
onPress={handleHome}
|
||||||
testID="sidebar-home"
|
testID="sidebar-home"
|
||||||
@@ -1008,8 +1064,8 @@ const styles = StyleSheet.create((theme) => ({
|
|||||||
sidebarFooter: {
|
sidebarFooter: {
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
justifyContent: "flex-start",
|
gap: theme.spacing[2],
|
||||||
paddingHorizontal: theme.spacing[4],
|
paddingHorizontal: theme.spacing[2],
|
||||||
paddingVertical: theme.spacing[3],
|
paddingVertical: theme.spacing[3],
|
||||||
borderTopWidth: 1,
|
borderTopWidth: 1,
|
||||||
borderTopColor: theme.colors.border,
|
borderTopColor: theme.colors.border,
|
||||||
@@ -1020,6 +1076,30 @@ const styles = StyleSheet.create((theme) => ({
|
|||||||
gap: theme.spacing[2],
|
gap: theme.spacing[2],
|
||||||
flexShrink: 0,
|
flexShrink: 0,
|
||||||
},
|
},
|
||||||
|
footerAddProjectButton: {
|
||||||
|
minWidth: 0,
|
||||||
|
minHeight: 32,
|
||||||
|
flex: 1,
|
||||||
|
flexDirection: "row",
|
||||||
|
alignItems: "center",
|
||||||
|
gap: theme.spacing[2],
|
||||||
|
paddingVertical: theme.spacing[1.5],
|
||||||
|
paddingHorizontal: theme.spacing[2],
|
||||||
|
borderRadius: theme.borderRadius.lg,
|
||||||
|
},
|
||||||
|
footerAddProjectButtonHovered: {
|
||||||
|
backgroundColor: theme.colors.surfaceSidebarHover,
|
||||||
|
},
|
||||||
|
footerAddProjectLabel: {
|
||||||
|
minWidth: 0,
|
||||||
|
flexShrink: 1,
|
||||||
|
fontSize: theme.fontSize.sm,
|
||||||
|
fontWeight: theme.fontWeight.normal,
|
||||||
|
color: theme.colors.foregroundMuted,
|
||||||
|
},
|
||||||
|
footerAddProjectLabelHovered: {
|
||||||
|
color: theme.colors.foreground,
|
||||||
|
},
|
||||||
footerIconButton: {
|
footerIconButton: {
|
||||||
width: 28,
|
width: 28,
|
||||||
height: 28,
|
height: 28,
|
||||||
|
|||||||
Reference in New Issue
Block a user