Skip to content

Commit de36cb4

Browse files
committed
fix use-org
1 parent 422f8b2 commit de36cb4

File tree

4 files changed

+35
-22
lines changed

4 files changed

+35
-22
lines changed

apps/dashboard/components/date-range-picker.tsx

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ import { useIsMobile } from "@/hooks/use-mobile";
1919
import { formatMonthDay } from "@/lib/formatters";
2020
import { cn } from "@/lib/utils";
2121

22-
type PresetRange = {
22+
interface PresetRange {
2323
label: string;
2424
getValue: () => DateRange;
25-
};
25+
}
2626

2727
const PRESET_RANGES: PresetRange[] = [
2828
{
@@ -83,14 +83,14 @@ const PRESET_RANGES: PresetRange[] = [
8383
},
8484
];
8585

86-
type DateRangePickerProps = {
86+
interface DateRangePickerProps {
8787
className?: string;
8888
value?: DateRange;
8989
onChange?: (dateRange: DateRange | undefined) => void;
9090
disabled?: boolean;
9191
maxDate?: Date;
9292
minDate?: Date;
93-
};
93+
}
9494

9595
export function DateRangePicker({
9696
className,
@@ -111,12 +111,16 @@ export function DateRangePicker({
111111
}, [value, isOpen]);
112112

113113
const daysDiff = useMemo(() => {
114-
if (!(tempRange?.from && tempRange?.to)) return 0;
114+
if (!(tempRange?.from && tempRange?.to)) {
115+
return 0;
116+
}
115117
return dayjs(tempRange.to).diff(dayjs(tempRange.from), "day") + 1;
116118
}, [tempRange]);
117119

118120
const activePreset = useMemo(() => {
119-
if (!(tempRange?.from && tempRange?.to)) return null;
121+
if (!(tempRange?.from && tempRange?.to)) {
122+
return null;
123+
}
120124
return PRESET_RANGES.find((preset) => {
121125
const presetRange = preset.getValue();
122126
return (
@@ -158,7 +162,9 @@ export function DateRangePicker({
158162
);
159163

160164
const formatDisplayRange = useCallback((range: DateRange | undefined) => {
161-
if (!(range?.from && range?.to)) return "Select dates";
165+
if (!(range?.from && range?.to)) {
166+
return "Select dates";
167+
}
162168

163169
const from = dayjs(range.from);
164170
const to = dayjs(range.to);
@@ -317,8 +323,12 @@ export function DateRangePicker({
317323
<Calendar
318324
defaultMonth={tempRange?.from || value?.from || new Date()}
319325
disabled={(date) => {
320-
if (minDate && date < minDate) return true;
321-
if (maxDate && date > maxDate) return true;
326+
if (minDate && date < minDate) {
327+
return true;
328+
}
329+
if (maxDate && date > maxDate) {
330+
return true;
331+
}
322332
return false;
323333
}}
324334
mode="range"

apps/dashboard/components/empty-state.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import { Button } from "@/components/ui/button";
66
import { Card, CardContent } from "@/components/ui/card";
77
import { cn } from "@/lib/utils";
88

9-
export type EmptyStateAction = {
9+
export interface EmptyStateAction {
1010
label: string;
1111
onClick: () => void;
1212
variant?: "default" | "outline" | "secondary";
1313
size?: "default" | "sm" | "lg" | "icon";
14-
};
14+
}
1515

16-
export type EmptyStateProps = {
16+
export interface EmptyStateProps {
1717
/** Main icon to display */
1818
icon: ReactElement<IconProps>;
1919
/** Main heading */
@@ -38,7 +38,7 @@ export type EmptyStateProps = {
3838
"aria-label"?: string;
3939
/** Whether this is the main content area */
4040
isMainContent?: boolean;
41-
};
41+
}
4242

4343
export const EmptyState = memo(function EmptyState({
4444
icon,
@@ -117,7 +117,7 @@ export const EmptyState = memo(function EmptyState({
117117
{showPlusBadge && (
118118
<button
119119
aria-label="Create new item"
120-
className="absolute -top-2 -right-2 cursor-pointer select-none rounded-full border-2 border-primary/10 bg-background p-2"
120+
className="-top-2 -right-2 absolute cursor-pointer select-none rounded-full border-2 border-primary/10 bg-background p-2"
121121
onClick={(e) => {
122122
e.stopPropagation();
123123
action?.onClick();
@@ -220,7 +220,7 @@ export const EmptyState = memo(function EmptyState({
220220
variant={action.variant || "default"}
221221
>
222222
{variant === "default" && (
223-
<div className="absolute inset-0 translate-x-[-100%] bg-linear-to-r from-white/0 via-white/20 to-white/0 transition-transform duration-700 group-hover:translate-x-[100%] motion-reduce:transform-none" />
223+
<div className="absolute inset-0 translate-x-full bg-linear-to-r from-white/0 via-white/20 to-white/0 transition-transform duration-700 group-hover:translate-x-full motion-reduce:transform-none" />
224224
)}
225225
{variant === "default" && (
226226
<PlusIcon

apps/dashboard/hooks/use-organizations.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,28 @@ import { orpc } from "@/lib/orpc";
99

1010
export type OrganizationRole = "owner" | "admin" | "member";
1111

12-
type CreateOrganizationData = {
12+
interface CreateOrganizationData {
1313
name: string;
1414
slug?: string;
1515
logo?: string;
1616
metadata?: Record<string, unknown>;
1717
};
1818

19-
type UpdateOrganizationData = {
19+
interface UpdateOrganizationData {
2020
name?: string;
2121
slug?: string;
2222
logo?: string;
2323
metadata?: Record<string, unknown>;
2424
};
2525

26-
type InviteMemberData = {
26+
interface InviteMemberData {
2727
email: string;
2828
role: OrganizationRole;
2929
organizationId?: string;
3030
resend?: boolean;
3131
};
3232

33-
export type UpdateMemberData = {
33+
export interface UpdateMemberData {
3434
memberId: string;
3535
role: OrganizationRole;
3636
organizationId?: string;
@@ -75,6 +75,9 @@ export function useOrganizations() {
7575
queryClient.invalidateQueries({
7676
queryKey: AUTH_QUERY_KEYS.activeOrganization,
7777
});
78+
queryClient.invalidateQueries({ queryKey: orpc.websites.listWithCharts.key() });
79+
queryClient.invalidateQueries({ queryKey: orpc.websites.list.key() });
80+
queryClient.invalidateQueries({ queryKey: orpc.websites.getById.key() });
7881
};
7982

8083
const createOrganizationMutation = useMutation(

packages/rpc/src/routers/apikeys.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ export const apikeysRouter = {
141141
input.organizationId
142142
? eq(apikey.organizationId, input.organizationId)
143143
: and(
144-
eq(apikey.userId, context.user.id),
145-
isNull(apikey.organizationId)
146-
)
144+
eq(apikey.userId, context.user.id),
145+
isNull(apikey.organizationId)
146+
)
147147
)
148148
.orderBy(desc(apikey.createdAt));
149149
return rows.map((r) => mapKey(r));

0 commit comments

Comments
 (0)