refactor: adjust date filter position and display
This commit is contained in:
parent
b6846b0419
commit
9d9cdb7354
@ -105,7 +105,7 @@ export const DateFilter: React.FC<DateFilterProps> = React.memo((props) => {
|
|||||||
open={showDropdown}
|
open={showDropdown}
|
||||||
onOpenChange={(open) => setShowDropdown(open)}
|
onOpenChange={(open) => setShowDropdown(open)}
|
||||||
>
|
>
|
||||||
<Button size="large">
|
<Button className="min-w-[150px] text-right" size="large">
|
||||||
<Space>
|
<Space>
|
||||||
{label}
|
{label}
|
||||||
<DownOutlined
|
<DownOutlined
|
||||||
|
@ -26,9 +26,10 @@ import { useNavigate } from 'react-router';
|
|||||||
|
|
||||||
export const WebsiteOverview: React.FC<{
|
export const WebsiteOverview: React.FC<{
|
||||||
website: WebsiteInfo;
|
website: WebsiteInfo;
|
||||||
|
showDateFilter?: boolean;
|
||||||
actions?: React.ReactNode;
|
actions?: React.ReactNode;
|
||||||
}> = React.memo((props) => {
|
}> = React.memo((props) => {
|
||||||
const { website, actions } = props;
|
const { website, showDateFilter = false, actions } = props;
|
||||||
const { startDate, endDate, unit, refresh } = useGlobalRangeDate();
|
const { startDate, endDate, unit, refresh } = useGlobalRangeDate();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
@ -115,9 +116,11 @@ export const WebsiteOverview: React.FC<{
|
|||||||
onClick={handleRefresh}
|
onClick={handleRefresh}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div>
|
{showDateFilter && (
|
||||||
<DateFilter />
|
<div>
|
||||||
</div>
|
<DateFilter />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ import arrayMove from 'array-move';
|
|||||||
import SortableList, { SortableItem } from 'react-easy-sort';
|
import SortableList, { SortableItem } from 'react-easy-sort';
|
||||||
import { defaultErrorHandler, defaultSuccessHandler, trpc } from '../api/trpc';
|
import { defaultErrorHandler, defaultSuccessHandler, trpc } from '../api/trpc';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
import { DateFilter } from '../components/DateFilter';
|
||||||
|
|
||||||
export const Dashboard: React.FC = React.memo(() => {
|
export const Dashboard: React.FC = React.memo(() => {
|
||||||
const workspace = useCurrentWorkspace();
|
const workspace = useCurrentWorkspace();
|
||||||
@ -31,7 +32,9 @@ export const Dashboard: React.FC = React.memo(() => {
|
|||||||
<div className="py-4">
|
<div className="py-4">
|
||||||
<div className="h-20 flex items-center">
|
<div className="h-20 flex items-center">
|
||||||
<div className="text-2xl flex-1">Dashboard</div>
|
<div className="text-2xl flex-1">Dashboard</div>
|
||||||
<div>
|
<div className="flex gap-4">
|
||||||
|
{!isEditLayout && <DateFilter />}
|
||||||
|
|
||||||
{websiteList.length !== 0 && (
|
{websiteList.length !== 0 && (
|
||||||
<Button
|
<Button
|
||||||
icon={<EditOutlined />}
|
icon={<EditOutlined />}
|
||||||
|
@ -38,7 +38,7 @@ export const WebsiteDetail: React.FC = React.memo(() => {
|
|||||||
<div className="py-6">
|
<div className="py-6">
|
||||||
<Card>
|
<Card>
|
||||||
<Card.Grid hoverable={false} className="!w-full">
|
<Card.Grid hoverable={false} className="!w-full">
|
||||||
<WebsiteOverview website={website} />
|
<WebsiteOverview website={website} showDateFilter={true} />
|
||||||
</Card.Grid>
|
</Card.Grid>
|
||||||
<Card.Grid hoverable={false} className="!w-1/2 min-h-[470px]">
|
<Card.Grid hoverable={false} className="!w-1/2 min-h-[470px]">
|
||||||
<MetricsTable
|
<MetricsTable
|
||||||
|
Loading…
Reference in New Issue
Block a user