Skip to content

Commit fbe9127

Browse files
committed
adjusting export button location
1 parent 4bc77ec commit fbe9127

File tree

2 files changed

+48
-37
lines changed

2 files changed

+48
-37
lines changed

components/dashboard/src/components/Button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
4747
type={htmlType}
4848
className={classNames(
4949
"cursor-pointer px-4 py-2 my-auto",
50-
"text-sm font-medium",
50+
"text-sm font-medium whitespace-nowrap",
5151
"rounded-md focus:outline-none focus:ring transition ease-in-out",
5252
type === "primary"
5353
? [

components/dashboard/src/components/UsageView.tsx

Lines changed: 47 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ function UsageView({ attributionId }: UsageViewProps) {
4343
const [endDate, setEndDate] = useState(dayjs());
4444
const supportedClasses = useWorkspaceClasses();
4545
const location = useLocation();
46-
const usageDownload = useFeatureFlag("usageDownload");
4746

4847
useEffect(() => {
4948
const match = /#(\d{4}-\d{2}-\d{2}):(\d{4}-\d{2}-\d{2})/.exec(location.hash);
@@ -145,14 +144,10 @@ function UsageView({ attributionId }: UsageViewProps) {
145144
<>
146145
<Header title="Usage" subtitle="Organization usage, updated every 15 minutes." />
147146
<div className="app-container pt-5">
148-
{usageDownload && (
149-
<div className="flex justify-end mb-4">
150-
<DownloadUsage attributionId={attributionId} startDate={startDate} endDate={endDate} />
151-
</div>
152-
)}
153147
{errorMessage && <p className="text-base">{errorMessage}</p>}
154148

155149
<UsageToolbar
150+
attributionId={attributionId}
156151
startDate={startDate}
157152
endDate={endDate}
158153
onStartDateChange={setStartDate}
@@ -305,12 +300,21 @@ export default UsageView;
305300

306301
// TODO: move these into the `/usage` folder once the export as csv feature is merged into this
307302
type UsageToolbarProps = {
303+
attributionId: AttributionId;
308304
startDate: Dayjs;
309305
endDate: Dayjs;
310306
onStartDateChange: (val: Dayjs) => void;
311307
onEndDateChange: (val: Dayjs) => void;
312308
};
313-
const UsageToolbar: FC<UsageToolbarProps> = ({ startDate, endDate, onStartDateChange, onEndDateChange }) => {
309+
const UsageToolbar: FC<UsageToolbarProps> = ({
310+
attributionId,
311+
startDate,
312+
endDate,
313+
onStartDateChange,
314+
onEndDateChange,
315+
}) => {
316+
const usageDownload = useFeatureFlag("usageDownload");
317+
314318
const handleRangeChanged = useCallback(
315319
(start: Dayjs, end: Dayjs) => {
316320
onStartDateChange(start);
@@ -322,38 +326,45 @@ const UsageToolbar: FC<UsageToolbarProps> = ({ startDate, endDate, onStartDateCh
322326
return (
323327
<div
324328
className={classNames(
325-
"flex items-start flex-col space-y-3 px-3",
326-
"sm:flex-row sm:items-center sm:space-x-4 sm:space-y-0",
329+
"flex flex-col items-start space-y-3 justify-between px-3",
330+
"md:flex-row md:items-center md:space-x-4 md:space-y-0",
327331
)}
328332
>
329-
<UsageDateRangePicker onChange={handleRangeChanged} />
330-
331-
<div className="flex items-center space-x-1">
332-
<DatePicker
333-
selected={startDate.toDate()}
334-
onChange={(date) => date && onStartDateChange(dayjs(date))}
335-
selectsStart
336-
startDate={startDate.toDate()}
337-
endDate={endDate.toDate()}
338-
maxDate={endDate.toDate()}
339-
customInput={<DateDisplay />}
340-
dateFormat={"MMM d, yyyy"}
341-
// tab loop enabled causes a bug w/ layout shift to the right of input when open
342-
enableTabLoop={false}
343-
/>
344-
<Subheading>to</Subheading>
345-
<DatePicker
346-
selected={endDate.toDate()}
347-
onChange={(date) => date && onEndDateChange(dayjs(date))}
348-
selectsEnd
349-
startDate={startDate.toDate()}
350-
endDate={endDate.toDate()}
351-
minDate={startDate.toDate()}
352-
customInput={<DateDisplay />}
353-
dateFormat={"MMM d, yyyy"}
354-
enableTabLoop={false}
355-
/>
333+
<div
334+
className={classNames(
335+
"flex flex-col items-start space-y-3",
336+
"sm:flex-row sm:items-center sm:space-x-4 sm:space-y-0",
337+
)}
338+
>
339+
<UsageDateRangePicker onChange={handleRangeChanged} />
340+
<div className="flex items-center space-x-1">
341+
<DatePicker
342+
selected={startDate.toDate()}
343+
onChange={(date) => date && onStartDateChange(dayjs(date))}
344+
selectsStart
345+
startDate={startDate.toDate()}
346+
endDate={endDate.toDate()}
347+
maxDate={endDate.toDate()}
348+
customInput={<DateDisplay />}
349+
dateFormat={"MMM d, yyyy"}
350+
// tab loop enabled causes a bug w/ layout shift to the right of input when open
351+
enableTabLoop={false}
352+
/>
353+
<Subheading>to</Subheading>
354+
<DatePicker
355+
selected={endDate.toDate()}
356+
onChange={(date) => date && onEndDateChange(dayjs(date))}
357+
selectsEnd
358+
startDate={startDate.toDate()}
359+
endDate={endDate.toDate()}
360+
minDate={startDate.toDate()}
361+
customInput={<DateDisplay />}
362+
dateFormat={"MMM d, yyyy"}
363+
enableTabLoop={false}
364+
/>
365+
</div>
356366
</div>
367+
{usageDownload && <DownloadUsage attributionId={attributionId} startDate={startDate} endDate={endDate} />}
357368
</div>
358369
);
359370
};

0 commit comments

Comments
 (0)