Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.production
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
VITE_API_BASE_URL=https://be.starters.rayonstudios.com/api
VITE_API_BASE_URL==https://be.starters.rayonstudios.com/api/v1
VITE_ENV=production
VITE_HCAPTCHA_SITE_KEY=cd86c190-7a30-4042-9468-018cd91ef63c
20 changes: 18 additions & 2 deletions src/lib/components/server-paginated-table/filters-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@ import { FilterOutlined } from "@ant-design/icons";
import { useDeepCompareLayoutEffect } from "ahooks";
import { Button, DatePicker, Form, Input, Select, Switch, Tooltip } from "antd";
import { useForm } from "antd/lib/form/Form";
import dayjs from "dayjs";
import localeData from "dayjs/plugin/localeData";
import weekday from "dayjs/plugin/weekday";
import { useState } from "react";
import CustomModal from "../custom-modal/custom-modal";
import ServerPaginatedSelect from "../server-paginated-select/server-paginated-select";

dayjs.extend(weekday);
dayjs.extend(localeData);
type Filter = {
label: string;
key: string;
Expand Down Expand Up @@ -46,8 +51,19 @@ function RenderFilter({ filter, value, onChange }: RenderFilterProps) {
<DatePicker
{...filter.filterProps}
allowClear
onChange={onChange}
value={value}
format="DD-MM-YYYY"
onChange={(date) => {
// If a date is selected, set time to 00:00:00 for start_date and 23:59:59 for end_date
if (!date) return onChange?.(null);
if (filter.key === "start_date") {
onChange?.(date.startOf("day"));
} else if (filter.key === "end_date") {
onChange?.(date.endOf("day"));
} else {
onChange?.(date);
}
}}
value={value ? dayjs(value) : null}
/>
);
case "boolean":
Expand Down
7 changes: 3 additions & 4 deletions src/lib/types/openapi-fetch.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,11 +599,10 @@ export interface components {
error: string | null;
};
/** @enum {string} */
"SortFields_Notification.created_at_": "created_at";
NotificationSortFields: components["schemas"]["SortFields_Notification.created_at_"];
DefaultSortFields: "created_at" | "updated_at";
NotificationFetchList: {
sortOrder?: components["schemas"]["SortOrder"];
sortField?: components["schemas"]["NotificationSortFields"];
sortField?: components["schemas"]["DefaultSortFields"];
/** Format: double */
limit?: number;
/** Format: double */
Expand Down Expand Up @@ -1057,7 +1056,7 @@ export interface operations {
parameters: {
query?: {
sortOrder?: components["schemas"]["SortOrder"];
sortField?: components["schemas"]["NotificationSortFields"];
sortField?: components["schemas"]["DefaultSortFields"];
limit?: number;
page?: number;
};
Expand Down