-
Notifications
You must be signed in to change notification settings - Fork 5k
Optimized MetricsBar & Fixed Mobile Layout #3258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
TanerKp
wants to merge
10
commits into
umami-software:dev
Choose a base branch
from
TanerKp:feat/website-metrics
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+176
−148
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f074ceb
Refactor website metrics components
TanerKp 17835d4
Remove unused showChange prop from WebsiteMetrics component
TanerKp 4bcddf6
Refactor imports to use default export for WebsiteMetrics component
TanerKp 6ced493
Merge pull request #3414 from umami-software/dev
mikecao 7aa0c83
Updated migration script.
mikecao 907a685
Update migration script.
mikecao 12cf668
Merge branch 'master' of https://github.com/umami-software/umami
mikecao 68fab48
fix: correct example description for Umami version in bug report temp…
monyasau b04077d
Merge pull request #3429 from monyasau/patch-1
mikecao 380e0a4
Merge branch 'master' into feat/website-metrics
TanerKp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { useMessages, useSticky } from '@/components/hooks'; | ||
import WebsiteDateFilter from '@/components/input/WebsiteDateFilter'; | ||
import useStore, { setWebsiteDateCompare } from '@/store/websites'; | ||
import classNames from 'classnames'; | ||
import { ReactNode } from 'react'; | ||
import { Dropdown, Item } from 'react-basics'; | ||
import WebsiteFilterButton from './WebsiteFilterButton'; | ||
import styles from './WebsiteMetrics.module.css'; | ||
|
||
export function WebsiteMetrics({ | ||
websiteId, | ||
sticky, | ||
compareMode = false, | ||
showFilter = false, | ||
children, | ||
}: { | ||
websiteId: string; | ||
sticky?: boolean; | ||
compareMode?: boolean; | ||
showFilter?: boolean; | ||
children?: ReactNode; | ||
}) { | ||
const { formatMessage, labels } = useMessages(); | ||
const { ref, isSticky } = useSticky({ enabled: sticky }); | ||
const dateCompare = useStore(state => state[websiteId]?.dateCompare); | ||
|
||
const items = [ | ||
{ label: formatMessage(labels.previousPeriod), value: 'prev' }, | ||
{ label: formatMessage(labels.previousYear), value: 'yoy' }, | ||
]; | ||
|
||
return ( | ||
<div | ||
ref={ref} | ||
className={classNames(styles.container, { | ||
[styles.sticky]: sticky, | ||
[styles.isSticky]: sticky && isSticky, | ||
})} | ||
> | ||
<div>{children}</div> | ||
<div className={styles.actions}> | ||
{showFilter && <WebsiteFilterButton websiteId={websiteId} />} | ||
<WebsiteDateFilter websiteId={websiteId} showAllTime={!compareMode} /> | ||
{compareMode && ( | ||
<div className={styles.vs}> | ||
<b>VS</b> | ||
<Dropdown | ||
className={styles.dropdown} | ||
items={items} | ||
value={dateCompare || 'prev'} | ||
renderValue={value => items.find(i => i.value === value)?.label} | ||
alignment="end" | ||
onChange={(value: any) => setWebsiteDateCompare(websiteId, value)} | ||
> | ||
{items.map(({ label, value }) => ( | ||
<Item key={value}>{label}</Item> | ||
))} | ||
</Dropdown> | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default WebsiteMetrics; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 22 additions & 27 deletions
49
src/app/(main)/websites/[websiteId]/events/EventsMetricsBar.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.