🔀 merge: main into develop
This commit is contained in:
@@ -9,7 +9,7 @@ import {
|
||||
} from "@workspace/ui/components/popover";
|
||||
import { cn } from "@workspace/ui/lib/utils";
|
||||
import { intlFormat } from "date-fns";
|
||||
import { CalendarIcon } from "lucide-react";
|
||||
import { CalendarIcon, X } from "lucide-react";
|
||||
import * as React from "react";
|
||||
import type { DayPicker } from "react-day-picker";
|
||||
|
||||
@@ -34,6 +34,15 @@ export function DatePicker({
|
||||
}
|
||||
};
|
||||
|
||||
const handleClear = (e: React.MouseEvent) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
setDate(undefined);
|
||||
if (onChange) {
|
||||
onChange(0);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Popover>
|
||||
<PopoverTrigger asChild>
|
||||
@@ -45,7 +54,19 @@ export function DatePicker({
|
||||
variant="outline"
|
||||
>
|
||||
{value ? intlFormat(value) : <span>{placeholder}</span>}
|
||||
<CalendarIcon className="size-4" />
|
||||
<div className="flex items-center gap-2">
|
||||
{value && (
|
||||
<button
|
||||
className="flex items-center"
|
||||
onClick={handleClear}
|
||||
onMouseDown={handleClear}
|
||||
type="button"
|
||||
>
|
||||
<X className="size-4 opacity-50 hover:opacity-100" />
|
||||
</button>
|
||||
)}
|
||||
<CalendarIcon className="size-4" />
|
||||
</div>
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent align="start" className="w-auto p-0">
|
||||
|
||||
@@ -60,7 +60,10 @@ export function MonacoEditor({
|
||||
const size = useSize(ref);
|
||||
|
||||
useEffect(() => {
|
||||
setInternalValue(propValue);
|
||||
// Only update internalValue if propValue has actually changed and is different from current value
|
||||
if (propValue !== internalValue) {
|
||||
setInternalValue(propValue);
|
||||
}
|
||||
}, [propValue]);
|
||||
|
||||
const debouncedOnChange = useRef(
|
||||
|
||||
@@ -128,13 +128,18 @@ export function TagInput({
|
||||
variant="outline"
|
||||
>
|
||||
{tag}
|
||||
<X
|
||||
className="size-4 cursor-pointer rounded-sm hover:text-destructive"
|
||||
<button
|
||||
className="ml-1 inline-flex items-center justify-center"
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
handleRemoveTag(index);
|
||||
}}
|
||||
/>
|
||||
onMouseDown={(e) => e.preventDefault()}
|
||||
type="button"
|
||||
>
|
||||
<X className="size-4 cursor-pointer rounded-sm hover:text-destructive" />
|
||||
</button>
|
||||
</Badge>
|
||||
))}
|
||||
<div className="flex min-w-0 flex-1 items-center gap-2">
|
||||
|
||||
@@ -135,6 +135,14 @@ function handleError(response: {
|
||||
"components:error.60005",
|
||||
"Single subscription mode has exceeded user limit"
|
||||
),
|
||||
60006: t(
|
||||
"components:error.60006",
|
||||
"User quota limit has been reached, unable to continue."
|
||||
),
|
||||
60007: t(
|
||||
"components:error.60007",
|
||||
"Insufficient inventory, please try again later or contact the administrator."
|
||||
),
|
||||
70001: t(
|
||||
"components:error.70001",
|
||||
"Incorrect verification code, please re-enter."
|
||||
@@ -185,7 +193,7 @@ request.interceptors.request.use(
|
||||
request.interceptors.response.use(
|
||||
(response) => {
|
||||
const { code } = response.data;
|
||||
if (code !== 200) {
|
||||
if (code !== 200 && code !== 0) {
|
||||
handleError({
|
||||
data: response.data,
|
||||
config: {
|
||||
|
||||
Reference in New Issue
Block a user