Skip to content

Commit

Permalink
Updated date range handling. Fixed share page.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecao committed Mar 9, 2023
1 parent 3fc5f51 commit 696d9c9
Show file tree
Hide file tree
Showing 28 changed files with 166 additions and 280 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@ export default function StickyHeader({
}) {
const { ref: scrollRef, isSticky } = useSticky({ scrollElement });
const { ref: measureRef, dimensions } = useMeasure();
const active = enabled && isSticky;

return (
<div
ref={measureRef}
data-sticky={enabled && isSticky}
style={enabled && isSticky ? { height: dimensions.height } : null}
data-sticky={active}
style={active ? { height: dimensions.height } : null}
>
<div
ref={scrollRef}
className={classNames(className, { [stickyClassName]: enabled && isSticky })}
style={enabled && isSticky ? { ...stickyStyle, width: dimensions.width } : null}
className={classNames(className, { [stickyClassName]: active })}
style={active ? { ...stickyStyle, width: dimensions.width } : null}
>
{children}
</div>
Expand Down
41 changes: 0 additions & 41 deletions components/helpers/CheckVisible.js

This file was deleted.

2 changes: 1 addition & 1 deletion components/input/DateFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function DateFilter({ websiteId, value, className }) {
const [showPicker, setShowPicker] = useState(false);

async function handleDateChange(value) {
if (value === 'all') {
if (value === 'all' && websiteId) {
const data = await get(`/websites/${websiteId}`);

if (data) {
Expand Down
6 changes: 3 additions & 3 deletions components/input/RefreshButton.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useIntl } from 'react-intl';
import { LoadingButton, Icon, Tooltip } from 'react-basics';
import { setDateRange } from 'store/websites';
import { setWebsiteDateRange } from 'store/websites';
import useDateRange from 'hooks/useDateRange';
import Icons from 'components/icons';
import { labels } from 'components/messages';
Expand All @@ -12,9 +12,9 @@ function RefreshButton({ websiteId, isLoading }) {
function handleClick() {
if (!isLoading && dateRange) {
if (/^\d+/.test(dateRange.value)) {
setDateRange(websiteId, dateRange.value);
setWebsiteDateRange(websiteId, dateRange.value);
} else {
setDateRange(websiteId, dateRange);
setWebsiteDateRange(websiteId, dateRange);
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion components/input/SettingsButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ export default function SettingsButton() {
</Icon>
</Button>
</Tooltip>
<Popup className={styles.popup} position="bottom" alignment="end">
<Popup
className={styles.popup}
position="bottom"
alignment="end"
onClick={e => e.stopPropagation()}
>
<Form>
<FormRow label={formatMessage(labels.timezone)}>
<TimezoneSetting />
Expand Down
80 changes: 0 additions & 80 deletions components/input/UserButton.js

This file was deleted.

25 changes: 0 additions & 25 deletions components/input/UserButton.module.css

This file was deleted.

4 changes: 2 additions & 2 deletions components/layout/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function Footer() {
return (
<footer className={styles.footer}>
<Row>
<Column defaultSize={11} xs={12} sm={12}>
<Column defaultSize={12} lg={11} xl={11}>
<div>
<FormattedMessage
{...labels.poweredBy}
Expand All @@ -22,7 +22,7 @@ export default function Footer() {
/>
</div>
</Column>
<Column className={styles.version} defaultSize={1} xs={12} sm={12}>
<Column className={styles.version} defaultSize={12} lg={1} xl={1}>
<a href={REPO_URL}>{`v${CURRENT_VERSION}`}</a>
</Column>
</Row>
Expand Down
8 changes: 2 additions & 6 deletions components/layout/Footer.module.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.footer {
font-size: var(--font-size-sm);
text-align: center;
line-height: 30px;
margin: 60px 0;
}

Expand All @@ -11,10 +12,5 @@
.version {
text-align: right;
padding-right: 10px;
}

@media only screen and (max-width: 768px) {
.footer .version {
text-align: center;
}
white-space: nowrap;
}
2 changes: 2 additions & 0 deletions components/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ export const labels = defineMessages({
logs: { id: 'label.activity-log', defaultMessage: 'Activity log' },
dismiss: { id: 'label.dismiss', defaultMessage: 'Dismiss' },
poweredBy: { id: 'label.powered-by', defaultMessage: 'Powered by {name}' },
pageViews: { id: 'label.page-views', defaultMessage: 'Page views' },
uniqueVisitors: { id: 'label.unique-visitors', defaultMessage: 'Unique visitors' },
});

export const messages = defineMessages({
Expand Down
Loading

0 comments on commit 696d9c9

Please sign in to comment.