Skip to content

Commit

Permalink
fix: scroll table (#874)
Browse files Browse the repository at this point in the history
* fix: scroll table

* fix: remove created

* fix: sort by start
  • Loading branch information
IanKrieger authored Aug 29, 2023
1 parent 46eeb37 commit b1c8205
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/components/Drawer/MiniSideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type RouteOption = {
onClick?: (event: MouseEvent<any>) => void;
};

const drawerWidth = 120;
const drawerWidth = 100;
export default function MiniSideBar({ children }: PropsWithChildren) {
const dashboardRoutes: RouteOption[] = [
{
Expand Down Expand Up @@ -151,8 +151,8 @@ const ItemBox = (props: RouteOption) => {
borderRadius: "0px",
gap: "3px",
visibility: props.disabled ? "hidden" : "visible",
paddingLeft: "5px",
paddingRight: "5px",
paddingLeft: "3px",
paddingRight: "3px",
}}
selected={match.url.includes(props.href)}
onClick={props.onClick}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Switch/OnOff.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function OnOff({ state, loading, end, onChange, type, source }: Props) {
disabled={loading}
/>
) : (
<Typography sx={{ textAlign: "center" }}>-</Typography>
<Typography sx={{ textAlign: "center", p: 0 }}>-</Typography>
)}
</span>
</Tooltip>
Expand Down
16 changes: 7 additions & 9 deletions src/user/campaignList/CampaignList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export function CampaignList({
selectedCampaigns,
onCampaignSelect,
}: Props) {
let initialSort = 9;
const [engagementData, setEngagementData] =
useState<Map<string, EngagementOverview>>();

Expand All @@ -60,7 +61,7 @@ export function CampaignList({
...r,
advertiserId: advertiser?.id ?? "",
}),
sx: { width: "1px" },
sx: { width: "1px", p: 0 },
sortable: false,
},
{
Expand All @@ -86,7 +87,7 @@ export function CampaignList({
extendedRenderer: (r) => (
<Status state={r.state} start={r.startAt} end={r.endAt} />
),
sx: { width: "10px" },
sx: { width: "1px", p: 0 },
},
{
title: "Budget",
Expand Down Expand Up @@ -134,15 +135,10 @@ export function CampaignList({
renderer: StandardRenderers.date,
align: "right",
},
{
title: "Created",
value: (c) => c.createdAt,
renderer: StandardRenderers.date,
align: "right",
},
];

if (advertiser?.selfServiceCreate && advertiser.selfServiceEdit) {
initialSort += 1;
columns.unshift({
title: "",
value: (c) => c.id,
Expand All @@ -155,13 +151,14 @@ export function CampaignList({
/>
),
align: "center",
sx: { width: "1px" },
});
}

return (
<EnhancedTable
rows={advertiser?.campaigns ?? []}
initialSortColumn={9}
initialSortColumn={initialSort}
initialSortDirection="desc"
columns={columns}
/>
Expand All @@ -182,6 +179,7 @@ const CampaignCheckBox = (props: CheckBoxProps) => {
<Checkbox
disabled={props.selectedCampaigns.length === 1 && !campaignSelected}
size="small"
sx={{ p: 0 }}
checked={campaignSelected}
onChange={(e) =>
props.onCampaignSelect(props.campaign.id, e.target.checked)
Expand Down
2 changes: 1 addition & 1 deletion src/user/views/user/CampaignView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export function CampaignView() {
}
sx={{
flexGrow: 1,
mr: 2,
overflowX: "auto",
}}
additionalAction={<CampaignAgeFilter disabled={loading} />}
>
Expand Down

0 comments on commit b1c8205

Please sign in to comment.