Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion web/sdk/admin/views/organizations/details/invoices/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,26 @@ const TRANSFORM_OPTIONS = {
},
};

// The backend stores invoice amounts in cents, but the amount filter input
// takes dollars — convert the filter value to cents before sending the query.
function convertAmountFiltersToCents(query: DataTableQuery): DataTableQuery {
if (!query.filters?.length) return query;
return {
...query,
filters: query.filters.map(filter =>
filter.name === "amount"
? {
...filter,
value: Math.round(Number(filter.value) * 100),
...(filter.numberValue !== undefined && {
numberValue: Math.round(filter.numberValue * 100),
}),
}
: filter,
),
};
}

const NoInvoices = () => {
return (
<EmptyState
Expand Down Expand Up @@ -81,7 +101,10 @@ export function OrganizationInvoicesView() {
const title = `Invoices | ${organization?.title} | ${t.organization({ plural: true, case: "capital" })}`;

const computedQuery = useMemo(() => {
const tempQuery = transformDataTableQueryToRQLRequest(tableQuery, TRANSFORM_OPTIONS);
const tempQuery = transformDataTableQueryToRQLRequest(
convertAmountFiltersToCents(tableQuery),
TRANSFORM_OPTIONS,
);
return {
...tempQuery,
search: searchQuery || "",
Expand Down
2 changes: 1 addition & 1 deletion web/sdk/admin/views/organizations/list/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export function CreateOrganizationPanel({
onError: (error) => {
if (error?.code === Code.AlreadyExists) {
setError("name", {
message: `${t.organization({ case: "capital" })} name already exists`,
message: `${t.organization({ case: "capital" })} URL is already taken`,
});
} else {
console.error("Unable to create new org:", error);
Expand Down
1 change: 1 addition & 0 deletions web/sdk/admin/views/organizations/list/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export const OrganizationsNavabar = ({
showClearButton={true}
size="small"
onBlur={onSearchBlur}
autoFocus
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check DataTable.Search autoFocus usage patterns

# Find all DataTable.Search usages with autoFocus
rg -n -B3 -A3 'DataTable\.Search' --type=tsx --type=ts -g '!node_modules' | rg -C3 'autoFocus'

Repository: raystack/frontier

Length of output: 89


Make autoFocus conditional for DataTable.Search
In web/sdk/admin/views/organizations/list/navbar.tsx (line 82), autoFocus will steal focus whenever the search input is shown on mount (when searchQuery is already set). Keep autoFocus for the explicit user action that opens search (e.g., clicking the search icon), and avoid focus stealing on initial render.

/>
) : (
<IconButton
Expand Down
Loading