login changes

This commit is contained in:
2026-09-02 11:46:41 +05:30
parent 7df8a49e5f
commit 52be0e30ac
7 changed files with 263 additions and 49 deletions

View File

@@ -23,16 +23,7 @@ import { Selector } from '@astryxdesign/core/Selector';
import { Text } from '@astryxdesign/core/Text';
import { VStack } from '@astryxdesign/core/VStack';
import { useTenantCategories, useTenantLocations, useTenants } from '@/queries/hooks';
/**
* The category the customer app browses.
*
* A constant because it is one on the app side too — its browse screen asks for
* `categoryid: 2` — and because a product filed anywhere else is invisible to
* shoppers rather than merely misfiled. Used only as a floor for a merchant with
* no categories of their own; an established tenant's real list always wins.
*/
const APP_BROWSE_CATEGORY = 2;
import { categoryOptionsFor } from '@/features/catalogue/tenantCategories';
/** Everything an upload needs before it can be turned into stock. */
export interface ImportTarget {
@@ -100,15 +91,10 @@ export function ImportScope({ value, onChange, isTenantFixed = false }: ImportSc
* perfectly good category and is a trap — the app does not browse it, so
* anything filed there is invisible to shoppers.
*/
const categoryOptions = useMemo(() => {
const own = (categories.data ?? []).map((entry) => ({
value: String(entry.categoryid),
label: entry.categoryname,
}));
if (own.length > 0) return own;
if (categories.isLoading) return [];
return [{ value: String(APP_BROWSE_CATEGORY), label: 'General (the category the app shows)' }];
}, [categories.data, categories.isLoading]);
const categoryOptions = useMemo(
() => categoryOptionsFor(categories.data, categories.isLoading),
[categories.data, categories.isLoading],
);
/**
* A single branch is not a choice, so it is made rather than offered.