diff --git a/packages/desktop-client/src/components/schedules/SchedulesTable.js b/packages/desktop-client/src/components/schedules/SchedulesTable.tsx similarity index 99% rename from packages/desktop-client/src/components/schedules/SchedulesTable.js rename to packages/desktop-client/src/components/schedules/SchedulesTable.tsx index 7b66b91510463fd9449972de759c05099b3a3db3..e6b625c2dd7230952c31d1470db753aab43bc62b 100644 --- a/packages/desktop-client/src/components/schedules/SchedulesTable.js +++ b/packages/desktop-client/src/components/schedules/SchedulesTable.tsx @@ -193,7 +193,6 @@ export function SchedulesTable({ <Row height={ROW_HEIGHT} inset={15} - backgroundColor="transparent" onClick={() => onSelect(item.id)} style={{ cursor: 'pointer', diff --git a/packages/desktop-client/src/components/schedules/StatusBadge.js b/packages/desktop-client/src/components/schedules/StatusBadge.tsx similarity index 85% rename from packages/desktop-client/src/components/schedules/StatusBadge.js rename to packages/desktop-client/src/components/schedules/StatusBadge.tsx index b5c6296445916c3e64ac39a2c9ade258e005b869..3e1c395f2b1598cdb4449e1414c004ec5ba39720 100644 --- a/packages/desktop-client/src/components/schedules/StatusBadge.js +++ b/packages/desktop-client/src/components/schedules/StatusBadge.tsx @@ -9,11 +9,11 @@ import CheckCircleHollow from '../../icons/v2/CheckCircleHollow'; import EditSkull1 from '../../icons/v2/EditSkull1'; import FavoriteStar from '../../icons/v2/FavoriteStar'; import ValidationCheck from '../../icons/v2/ValidationCheck'; -import { colors } from '../../style'; +import { colors, type CSSProperties } from '../../style'; import Text from '../common/Text'; import View from '../common/View'; -export function getStatusProps(status) { +export function getStatusProps(status: Status) { let color, backgroundColor, Icon; switch (status) { @@ -67,7 +67,22 @@ export function getStatusProps(status) { return { color, backgroundColor, Icon }; } -export function StatusBadge({ status, style }) { +type Status = + | 'missed' + | 'due' + | 'upcoming' + | 'paid' + | 'completed' + | 'pending' + | 'scheduled' + | 'cleared'; + +type StatusBadgeProps = { + status: Status; + style?: CSSProperties; +}; + +export function StatusBadge({ status, style }: StatusBadgeProps) { let { color, backgroundColor, Icon } = getStatusProps(status); return ( <View diff --git a/packages/desktop-client/src/components/table.tsx b/packages/desktop-client/src/components/table.tsx index 504ff46393a7ff5ceb0c6a4e606d2290ba2b4c49..19aead8b56605571017ccf4243e9d603a91842f3 100644 --- a/packages/desktop-client/src/components/table.tsx +++ b/packages/desktop-client/src/components/table.tsx @@ -858,8 +858,8 @@ type TableProps = { items: TableItem[]; count?: number; headers?: ReactNode | TableHeaderProps['headers']; - contentHeader: ReactNode; - loading: boolean; + contentHeader?: ReactNode; + loading?: boolean; rowHeight?: number; backgroundColor?: string; renderItem: (arg: { @@ -871,16 +871,15 @@ type TableProps = { position: number; }) => ReactNode; renderEmpty?: ReactNode | (() => ReactNode); - getItemKey: (index: number) => TableItem['id']; + getItemKey?: (index: number) => TableItem['id']; loadMore?: () => void; style?: CSSProperties; - navigator: ReturnType<typeof useTableNavigator>; - listRef; - onScroll: () => void; + navigator?: ReturnType<typeof useTableNavigator>; + onScroll?: () => void; version?: string; allowPopupsEscape?: boolean; isSelected?: (id: TableItem['id']) => boolean; - saveScrollWidth: (parent, child) => void; + saveScrollWidth?: (parent, child) => void; }; export const Table = forwardRef<TableHandleRef, TableProps>( @@ -899,7 +898,6 @@ export const Table = forwardRef<TableHandleRef, TableProps>( loadMore, style, navigator, - listRef, onScroll, version = 'v1', allowPopupsEscape, diff --git a/upcoming-release-notes/1660.md b/upcoming-release-notes/1660.md new file mode 100644 index 0000000000000000000000000000000000000000..b570063ae555e7b5f86d13f7ab464e36cf761a4e --- /dev/null +++ b/upcoming-release-notes/1660.md @@ -0,0 +1,6 @@ +--- +category: Maintenance +authors: [doggan] +--- + +Migrate some components to TypeScript.