mirror of https://github.com/buster-so/buster.git
date picker should conditionally hide clearable 👻
This commit is contained in:
parent
8494f12189
commit
fec77bda4b
|
@ -135,7 +135,7 @@ export const useShareCollection = () => {
|
||||||
const queryKey = collectionQueryKeys.collectionsGetCollection(id).queryKey;
|
const queryKey = collectionQueryKeys.collectionsGetCollection(id).queryKey;
|
||||||
queryClient.setQueryData(queryKey, (previousData) => {
|
queryClient.setQueryData(queryKey, (previousData) => {
|
||||||
return create(previousData!, (draft: BusterCollection) => {
|
return create(previousData!, (draft: BusterCollection) => {
|
||||||
draft.individual_permissions?.push(...params);
|
draft.individual_permissions = [...params, ...(draft.individual_permissions || [])];
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -320,7 +320,10 @@ export const useShareDashboard = () => {
|
||||||
const queryKey = dashboardQueryKeys.dashboardGetDashboard(variables.id).queryKey;
|
const queryKey = dashboardQueryKeys.dashboardGetDashboard(variables.id).queryKey;
|
||||||
queryClient.setQueryData(queryKey, (previousData) => {
|
queryClient.setQueryData(queryKey, (previousData) => {
|
||||||
return create(previousData!, (draft) => {
|
return create(previousData!, (draft) => {
|
||||||
draft.individual_permissions?.push(...variables.params);
|
draft.individual_permissions = [
|
||||||
|
...variables.params,
|
||||||
|
...(draft.individual_permissions || [])
|
||||||
|
];
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -312,7 +312,10 @@ export const useShareMetric = () => {
|
||||||
const queryKey = metricsQueryKeys.metricsGetMetric(variables.id).queryKey;
|
const queryKey = metricsQueryKeys.metricsGetMetric(variables.id).queryKey;
|
||||||
queryClient.setQueryData(queryKey, (previousData: IBusterMetric | undefined) => {
|
queryClient.setQueryData(queryKey, (previousData: IBusterMetric | undefined) => {
|
||||||
return create(previousData!, (draft: IBusterMetric) => {
|
return create(previousData!, (draft: IBusterMetric) => {
|
||||||
draft.individual_permissions?.push(...variables.params);
|
draft.individual_permissions = [
|
||||||
|
...variables.params,
|
||||||
|
...(draft.individual_permissions || [])
|
||||||
|
];
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -42,10 +42,11 @@ function DatePickerComponent({
|
||||||
variant={'ghost'}
|
variant={'ghost'}
|
||||||
prefix={<CalendarIcon />}
|
prefix={<CalendarIcon />}
|
||||||
suffix={
|
suffix={
|
||||||
clearable && (
|
clearable &&
|
||||||
|
selected && (
|
||||||
<div
|
<div
|
||||||
onClick={onClickCancel}
|
onClick={onClickCancel}
|
||||||
className="hover:bg-gray-light/20 hover:text-default! flex items-center justify-center rounded-sm p-0.5 text-xs opacity-30 transition-opacity duration-200 group-hover:opacity-100">
|
className="hover:bg-gray-light/20 hover:text-default! -mr-1 flex items-center justify-center rounded-sm p-1 text-xs opacity-30 transition-opacity duration-200 group-hover:opacity-100">
|
||||||
<Xmark />
|
<Xmark />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
@ -65,7 +66,7 @@ function DatePickerComponent({
|
||||||
</Button>
|
</Button>
|
||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
<PopoverContent className="w-auto p-0">
|
<PopoverContent className="w-auto p-0">
|
||||||
<Calendar mode="single" selected={selected} onSelect={onSelect} initialFocus />
|
<Calendar {...props} mode="single" selected={selected} onSelect={onSelect} initialFocus />
|
||||||
</PopoverContent>
|
</PopoverContent>
|
||||||
</Popover>
|
</Popover>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue