Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go
1.4 KB
Raw Blame
/**
 * ↑ submit icon button rendered in the new-issue modal's Stack header
 * (headerRight slot). Visually pairs with ModalCloseButton on the left:
 * same size/shape circle, brand accent when active vs dimmed disabled
 * state. Shows a spinner instead of the arrow while the mutation is
 * in-flight, so the user can't double-tap.
 */
import { ActivityIndicator, Pressable, View } from "react-native";
import { Ionicons } from "@expo/vector-icons";
import { cn } from "@/lib/utils";
import { useT } from "@/lib/i18n";

interface Props {
  disabled: boolean;
  onPress: () => void;
  loading?: boolean;
}

export function SubmitIssueButton({ disabled, onPress, loading }: Props) {
  const { t } = useT("issues");
  const interactive = !disabled && !loading;
  return (
    <Pressable
      onPress={interactive ? onPress : undefined}
      hitSlop={8}
      accessibilityLabel={t("new.create")}
      accessibilityState={{ disabled: !interactive, busy: loading }}
      className={cn(interactive && "active:opacity-60")}
    >
      <View
        className={cn(
          "size-7 items-center justify-center rounded-full",
          interactive ? "bg-brand" : "bg-secondary",
        )}
      >
        {loading ? (
          <ActivityIndicator size="small" color="#ffffff" />
        ) : (
          <Ionicons
            name="arrow-up"
            size={18}
            color={interactive ? "#ffffff" : "#a1a1aa"}
          />
        )}
      </View>
    </Pressable>
  );
}