π OpenHands: AI-Driven Development
chore: remove orphaned repository-selection dir and unused pagination/interactive-chip UI (#1234)
Hiep Le28be9534e53b
diff --git a/src/components/features/home/repository-selection/branch-dropdown.tsx b/src/components/features/home/repository-selection/branch-dropdown.tsxdeleted file mode 100644index cd30f702a4..0000000000--- a/src/components/features/home/repository-selection/branch-dropdown.tsx+++ /dev/null@@ -1,42 +0,0 @@-import React, { ReactNode } from "react";-import { useTranslation } from "react-i18next";-import { SettingsDropdownInput } from "../../settings/settings-dropdown-input";-import { I18nKey } from "#/i18n/declaration";-import { cn } from "#/utils/utils";--export interface BranchDropdownProps {- items: { key: React.Key; label: string }[];- onSelectionChange: (key: React.Key | null) => void;- onInputChange: (value: string) => void;- isDisabled: boolean;- selectedKey?: string;- wrapperClassName?: string;- label?: ReactNode;-}--export function BranchDropdown({- items,- onSelectionChange,- onInputChange,- isDisabled,- selectedKey,- wrapperClassName,- label,-}: BranchDropdownProps) {- const { t } = useTranslation("openhands");-- return (- <SettingsDropdownInput- testId="branch-dropdown"- name="branch-dropdown"- placeholder={t(I18nKey.REPOSITORY$SELECT_BRANCH)}- items={items}- wrapperClassName={cn("max-w-[500px]", wrapperClassName)}- onSelectionChange={onSelectionChange}- onInputChange={onInputChange}- isDisabled={isDisabled}- selectedKey={selectedKey}- label={label}- />- );-}diff --git a/src/components/features/home/repository-selection/branch-error-state.tsx b/src/components/features/home/repository-selection/branch-error-state.tsxdeleted file mode 100644index 87a569d00b..0000000000--- a/src/components/features/home/repository-selection/branch-error-state.tsx+++ /dev/null@@ -1,24 +0,0 @@-import { useTranslation } from "react-i18next";-import { cn } from "#/utils/utils";-import { formControlFieldClassName } from "#/utils/form-control-classes";-import { I18nKey } from "#/i18n/declaration";--interface BranchErrorStateProps {- wrapperClassName?: string;-}--export function BranchErrorState({ wrapperClassName }: BranchErrorStateProps) {- const { t } = useTranslation("openhands");- return (- <div- data-testid="branch-dropdown-error"- className={cn(- formControlFieldClassName,- "flex max-w-[500px] items-center gap-2 text-red-500",- wrapperClassName,- )}- >- <span className="text-sm">{t(I18nKey.HOME$FAILED_TO_LOAD_BRANCHES)}</span>- </div>- );-}diff --git a/src/components/features/home/repository-selection/branch-loading-state.tsx b/src/components/features/home/repository-selection/branch-loading-state.tsxdeleted file mode 100644index 9ecd3809c3..0000000000--- a/src/components/features/home/repository-selection/branch-loading-state.tsx+++ /dev/null@@ -1,28 +0,0 @@-import { useTranslation } from "react-i18next";-import { Spinner } from "@heroui/react";-import { cn } from "#/utils/utils";-import { formControlFieldClassName } from "#/utils/form-control-classes";-import { I18nKey } from "#/i18n/declaration";--interface BranchLoadingStateProps {- wrapperClassName?: string;-}--export function BranchLoadingState({- wrapperClassName,-}: BranchLoadingStateProps) {- const { t } = useTranslation("openhands");- return (- <div- data-testid="branch-dropdown-loading"- className={cn(- formControlFieldClassName,- "flex max-w-[500px] items-center gap-2",- wrapperClassName,- )}- >- <Spinner size="sm" />- <span className="text-sm">{t(I18nKey.HOME$LOADING_BRANCHES)}</span>- </div>- );-}diff --git a/src/components/features/home/repository-selection/git-provider-dropdown.tsx b/src/components/features/home/repository-selection/git-provider-dropdown.tsxdeleted file mode 100644index 5f5d41624f..0000000000--- a/src/components/features/home/repository-selection/git-provider-dropdown.tsx+++ /dev/null@@ -1,61 +0,0 @@-import React from "react";-import { useTranslation } from "react-i18next";-import { SettingsDropdownInput } from "../../settings/settings-dropdown-input";-import { I18nKey } from "#/i18n/declaration";-import { GitProviderIcon } from "#/components/shared/git-provider-icon";-import { Provider } from "#/types/settings";-import { cn } from "#/utils/utils";--export interface GitProviderDropdownProps {- items: { key: React.Key; label: string }[];- onSelectionChange: (key: React.Key | null) => void;- onInputChange: (value: string) => void;- defaultFilter?: (textValue: string, inputValue: string) => boolean;- selectedKey?: string;- wrapperClassName?: string;- inputWrapperClassName?: string;- inputClassName?: string;- isClearable?: boolean;- isDisabled?: boolean;-}--export function GitProviderDropdown({- items,- onSelectionChange,- onInputChange,- defaultFilter,- selectedKey,- wrapperClassName,- inputWrapperClassName,- inputClassName,- isClearable,- isDisabled,-}: GitProviderDropdownProps) {- const { t } = useTranslation("openhands");-- return (- <SettingsDropdownInput- testId="git-provider-dropdown"- name="git-provider-dropdown"- placeholder={t(I18nKey.COMMON$SELECT_GIT_PROVIDER)}- items={items}- wrapperClassName={cn("max-w-[500px]", wrapperClassName)}- onSelectionChange={onSelectionChange}- onInputChange={onInputChange}- defaultFilter={defaultFilter}- startContent={- selectedKey && (- <GitProviderIcon- gitProvider={selectedKey as Provider}- className="min-w-[14px] min-h-[14px] w-[14px] h-[14px]"- />- )- }- inputWrapperClassName={inputWrapperClassName}- inputClassName={inputClassName}- isClearable={isClearable}- isDisabled={isDisabled}- defaultSelectedKey={selectedKey}- />- );-}diff --git a/src/components/features/home/repository-selection/index.ts b/src/components/features/home/repository-selection/index.tsdeleted file mode 100644index 1bd1139230..0000000000--- a/src/components/features/home/repository-selection/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export { BranchDropdown } from "#/components/features/home/repository-selection/branch-dropdown";-export { BranchLoadingState } from "#/components/features/home/repository-selection/branch-loading-state";-export { BranchErrorState } from "#/components/features/home/repository-selection/branch-error-state";diff --git a/src/components/features/home/repository-selection/repository-dropdown.tsx b/src/components/features/home/repository-selection/repository-dropdown.tsxdeleted file mode 100644index 0d5d7510e0..0000000000--- a/src/components/features/home/repository-selection/repository-dropdown.tsx+++ /dev/null@@ -1,42 +0,0 @@-import React from "react";-import { useTranslation } from "react-i18next";-import { SettingsDropdownInput } from "../../settings/settings-dropdown-input";-import { I18nKey } from "#/i18n/declaration";-import { cn } from "#/utils/utils";--export interface RepositoryDropdownProps {- items: { key: React.Key; label: string }[];- onSelectionChange: (key: React.Key | null) => void;- onInputChange: (value: string) => void;- defaultFilter?: (textValue: string, inputValue: string) => boolean;- wrapperClassName?: string;- defaultSelectedKey?: string;- selectedKey?: string;-}--export function RepositoryDropdown({- items,- onSelectionChange,- onInputChange,- defaultFilter,- wrapperClassName,- defaultSelectedKey,- selectedKey,-}: RepositoryDropdownProps) {- const { t } = useTranslation("openhands");-- return (- <SettingsDropdownInput- testId="repo-dropdown"- name="repo-dropdown"- placeholder={t(I18nKey.REPOSITORY$SELECT_REPO)}- items={items}- wrapperClassName={cn("max-w-[500px]", wrapperClassName)}- onSelectionChange={onSelectionChange}- onInputChange={onInputChange}- defaultFilter={defaultFilter}- defaultSelectedKey={defaultSelectedKey}- selectedKey={selectedKey}- />- );-}diff --git a/src/components/features/home/repository-selection/repository-error-state.tsx b/src/components/features/home/repository-selection/repository-error-state.tsxdeleted file mode 100644index ad0c22e59f..0000000000--- a/src/components/features/home/repository-selection/repository-error-state.tsx+++ /dev/null@@ -1,28 +0,0 @@-import { useTranslation } from "react-i18next";-import { cn } from "#/utils/utils";-import { formControlFieldClassName } from "#/utils/form-control-classes";-import { I18nKey } from "#/i18n/declaration";--export interface RepositoryErrorStateProps {- wrapperClassName?: string;-}--export function RepositoryErrorState({- wrapperClassName,-}: RepositoryErrorStateProps) {- const { t } = useTranslation("openhands");- return (- <div- data-testid="repo-dropdown-error"- className={cn(- formControlFieldClassName,- "flex max-w-[500px] items-center gap-2 text-red-500",- wrapperClassName,- )}- >- <span className="text-sm">- {t(I18nKey.HOME$FAILED_TO_LOAD_REPOSITORIES)}- </span>- </div>- );-}diff --git a/src/components/features/home/repository-selection/repository-loading-state.tsx b/src/components/features/home/repository-selection/repository-loading-state.tsxdeleted file mode 100644index 91e8d3da02..0000000000--- a/src/components/features/home/repository-selection/repository-loading-state.tsx+++ /dev/null@@ -1,28 +0,0 @@-import { useTranslation } from "react-i18next";-import { Spinner } from "@heroui/react";-import { cn } from "#/utils/utils";-import { formControlFieldClassName } from "#/utils/form-control-classes";-import { I18nKey } from "#/i18n/declaration";--export interface RepositoryLoadingStateProps {- wrapperClassName?: string;-}--export function RepositoryLoadingState({- wrapperClassName,-}: RepositoryLoadingStateProps) {- const { t } = useTranslation("openhands");- return (- <div- data-testid="repo-dropdown-loading"- className={cn(- formControlFieldClassName,- "flex max-w-[500px] items-center gap-2",- wrapperClassName,- )}- >- <Spinner size="sm" />- <span className="text-sm">{t(I18nKey.HOME$LOADING_REPOSITORIES)}</span>- </div>- );-}diff --git a/src/ui/interactive-chip.tsx b/src/ui/interactive-chip.tsxdeleted file mode 100644index ea863592c9..0000000000--- a/src/ui/interactive-chip.tsx+++ /dev/null@@ -1,33 +0,0 @@-import { cn } from "#/utils/utils";--interface InteractiveChipProps {- onClick: () => void;- testId?: string;- className?: string;-}--/**- * Small clickable chip component for actions like "Add"- * Uses gray background with black text- */-export function InteractiveChip({- children,- onClick,- testId,- className,-}: React.PropsWithChildren<InteractiveChipProps>) {- return (- <button- type="button"- data-testid={testId}- onClick={onClick}- className={cn(- "bg-[var(--oh-text-tertiary)] px-2 rounded-[100px] text-black text-sm text-center font-normal cursor-pointer",- "hover:bg-[var(--oh-text-tertiary)] transition-colors",- className,- )}- >- {children}- </button>- );-}diff --git a/src/ui/pagination.tsx b/src/ui/pagination.tsxdeleted file mode 100644index 07708f47b4..0000000000--- a/src/ui/pagination.tsx+++ /dev/null@@ -1,129 +0,0 @@-import { ChevronLeft } from "#/assets/chevron-left";-import { ChevronRight } from "#/assets/chevron-right";-import { cn } from "#/utils/utils";--interface PaginationProps {- currentPage: number;- totalPages: number;- onPageChange: (page: number) => void;- className?: string;-}--export function Pagination({- currentPage,- totalPages,- onPageChange,- className,-}: PaginationProps) {- // Generate page numbers to display- const getPageNumbers = (): (number | "ellipsis")[] => {- const pages: (number | "ellipsis")[] = [];- const showEllipsis = totalPages > 7;-- if (!showEllipsis) {- // Show all pages if 7 or fewer- for (let i = 1; i <= totalPages; i += 1) {- pages.push(i);- }- } else {- // Always show first page- pages.push(1);-- if (currentPage > 3) {- pages.push("ellipsis");- }-- // Show pages around current- const start = Math.max(2, currentPage - 1);- const end = Math.min(totalPages - 1, currentPage + 1);-- for (let i = start; i <= end; i += 1) {- pages.push(i);- }-- if (currentPage < totalPages - 2) {- pages.push("ellipsis");- }-- // Always show last page- if (totalPages > 1) {- pages.push(totalPages);- }- }-- return pages;- };-- const canGoPrevious = currentPage > 1;- const canGoNext = currentPage < totalPages;-- if (totalPages <= 1) {- return null;- }-- return (- <nav- className={cn("flex items-center justify-center gap-1", className)}- aria-label="Pagination"- >- {/* Previous button */}- <button- type="button"- onClick={() => onPageChange(currentPage - 1)}- disabled={!canGoPrevious}- className={cn(- "p-2 rounded-md transition-colors",- canGoPrevious- ? "hover:bg-surface-outline cursor-pointer"- : "opacity-50 cursor-not-allowed",- )}- aria-label="Previous page"- >- <ChevronLeft width={16} height={16} active={canGoPrevious} />- </button>-- {/* Page numbers */}- {getPageNumbers().map((page, index) =>- page === "ellipsis" ? (- <span- key={`ellipsis-${index}`}- className="px-2 text-sm text-tertiary-alt"- >- ...- </span>- ) : (- <button- key={page}- type="button"- onClick={() => onPageChange(page)}- className={cn(- "min-w-[32px] h-8 px-2 text-sm rounded-md transition-colors cursor-pointer",- currentPage === page- ? "bg-surface-button text-white font-normal"- : "text-tertiary-alt hover:bg-surface-outline",- )}- aria-current={currentPage === page ? "page" : undefined}- >- {page}- </button>- ),- )}-- {/* Next button */}- <button- type="button"- onClick={() => onPageChange(currentPage + 1)}- disabled={!canGoNext}- className={cn(- "p-2 rounded-md transition-colors",- canGoNext- ? "hover:bg-surface-outline cursor-pointer"- : "opacity-50 cursor-not-allowed",- )}- aria-label="Next page"- >- <ChevronRight width={16} height={16} active={canGoNext} />- </button>- </nav>- );-}