fix: SMS dropdown text fits, align hide toggle on row, no skeleton flash on toggle

This commit is contained in:
Hermes 2026-08-19 12:52:38 +02:00
parent 46fac18e28
commit ebff56c749
2 changed files with 15 additions and 6 deletions

View File

@ -47,7 +47,7 @@ const DropdownSelect = ({ value, options, onChange, placeholder }) => {
{isOpen ? (
<div
role="listbox"
className="absolute left-0 right-0 top-full z-20 mt-2 overflow-hidden rounded-2xl border border-[var(--color-border)] bg-[var(--color-dropdown-surface)] shadow-soft"
className="absolute left-0 top-full z-20 mt-2 w-max min-w-full whitespace-nowrap overflow-hidden rounded-2xl border border-[var(--color-border)] bg-[var(--color-dropdown-surface)] shadow-soft"
>
{options.map((option) => {
const isSelected = option.value === value;
@ -206,7 +206,7 @@ export const OrderFilters = ({ filters, setFilters, statusOptions = [], cities =
</div>
{/* Row 2: Date range + SMS problems (width matches its text) + hide-completed toggle */}
<div className="flex flex-wrap items-end gap-3">
<div className="flex flex-wrap items-center gap-3">
<DatePicker
value={filters.dateFrom || ""}
onChange={(v) => updateFilter("dateFrom", v)}

View File

@ -92,13 +92,22 @@ export const useOrderGroups = ({
}, [enabled, details, groupId, hideCompleted]);
// Initial load
const hasLoadedRef = React.useRef(false);
React.useEffect(() => {
let cancelled = false;
const doLoad = async () => {
const hasCache = !!readOrderGroupsCache(details, hideCompleted);
// If we seeded from cache, don't flash the spinner — refresh silently in bg.
setIsLoading(!hasCache);
await loadLiveData(!hasCache, { forceRefresh: true });
const isFirst = !hasLoadedRef.current;
if (isFirst) {
const hasCache = !!readOrderGroupsCache(details, hideCompleted);
// Full skeleton only on the very first entry; otherwise refresh silently
// so toggling the "hide completed" switch updates the list in place
// without flashing the whole page / jumping to top.
setIsLoading(!hasCache);
await loadLiveData(!hasCache, { forceRefresh: true });
hasLoadedRef.current = true;
} else {
await loadLiveData(false, { forceRefresh: true });
}
if (cancelled) return;
};
if (enabled) doLoad(); else { setOrderGroups([]); setIsLoading(false); }