-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2203 from umami-software/dev
v2.5.0
- Loading branch information
Showing
277 changed files
with
21,983 additions
and
11,263 deletions.
There are no files selected for viewing
This file contains 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 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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,45 @@ | ||
import styles from './Pager.module.css'; | ||
import { Button, Flexbox, Icon, Icons } from 'react-basics'; | ||
import useMessages from 'hooks/useMessages'; | ||
|
||
export function Pager({ page, pageSize, count, onPageChange }) { | ||
const { formatMessage, labels } = useMessages(); | ||
const maxPage = Math.ceil(count / pageSize); | ||
const lastPage = page === maxPage; | ||
const firstPage = page === 1; | ||
|
||
if (count === 0) { | ||
return null; | ||
} | ||
|
||
const handlePageChange = value => { | ||
const nextPage = page + value; | ||
if (nextPage > 0 && nextPage <= maxPage) { | ||
onPageChange(nextPage); | ||
} | ||
}; | ||
|
||
if (maxPage === 1) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Flexbox justifyContent="center" className={styles.container}> | ||
<Button onClick={() => handlePageChange(-1)} disabled={firstPage}> | ||
<Icon rotate={90}> | ||
<Icons.ChevronDown /> | ||
</Icon> | ||
</Button> | ||
<Flexbox alignItems="center" className={styles.text}> | ||
{formatMessage(labels.pageOf, { current: page, total: maxPage })} | ||
</Flexbox> | ||
<Button onClick={() => handlePageChange(1)} disabled={lastPage}> | ||
<Icon rotate={270}> | ||
<Icons.ChevronDown /> | ||
</Icon> | ||
</Button> | ||
</Flexbox> | ||
); | ||
} | ||
|
||
export default Pager; |
This file contains 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,7 @@ | ||
.container { | ||
margin-top: 20px; | ||
} | ||
|
||
.text { | ||
margin: 0 16px; | ||
} |
This file contains 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 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 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 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,71 @@ | ||
import { useRef } from 'react'; | ||
import { | ||
Text, | ||
Icon, | ||
CalendarMonthSelect, | ||
CalendarYearSelect, | ||
Button, | ||
PopupTrigger, | ||
Popup, | ||
} from 'react-basics'; | ||
import { startOfMonth, endOfMonth } from 'date-fns'; | ||
import Icons from 'components/icons'; | ||
import { useLocale } from 'hooks'; | ||
import { formatDate } from 'lib/date'; | ||
import { getDateLocale } from 'lib/lang'; | ||
import styles from './MonthSelect.module.css'; | ||
|
||
export function MonthSelect({ date = new Date(), onChange }) { | ||
const { locale } = useLocale(); | ||
const month = formatDate(date, 'MMMM', locale); | ||
const year = date.getFullYear(); | ||
const ref = useRef(); | ||
|
||
const handleChange = (close, date) => { | ||
onChange(`range:${startOfMonth(date).getTime()}:${endOfMonth(date).getTime()}`); | ||
close(); | ||
}; | ||
|
||
return ( | ||
<> | ||
<div ref={ref} className={styles.container}> | ||
<PopupTrigger> | ||
<Button className={styles.input} variant="quiet"> | ||
<Text>{month}</Text> | ||
<Icon size="sm"> | ||
<Icons.ChevronDown /> | ||
</Icon> | ||
</Button> | ||
<Popup className={styles.popup} alignment="start"> | ||
{close => ( | ||
<CalendarMonthSelect | ||
date={date} | ||
locale={getDateLocale(locale)} | ||
onSelect={handleChange.bind(null, close)} | ||
/> | ||
)} | ||
</Popup> | ||
</PopupTrigger> | ||
<PopupTrigger> | ||
<Button className={styles.input} variant="quiet"> | ||
<Text>{year}</Text> | ||
<Icon size="sm"> | ||
<Icons.ChevronDown /> | ||
</Icon> | ||
</Button> | ||
<Popup className={styles.popup} alignment="start"> | ||
{close => ( | ||
<CalendarYearSelect | ||
date={date} | ||
locale={getDateLocale(locale)} | ||
onSelect={handleChange.bind(null, close)} | ||
/> | ||
)} | ||
</Popup> | ||
</PopupTrigger> | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
export default MonthSelect; |
This file contains 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,22 @@ | ||
.container { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
border: 1px solid var(--base400); | ||
border-radius: var(--border-radius); | ||
} | ||
|
||
.input { | ||
display: flex; | ||
align-items: center; | ||
gap: 10px; | ||
cursor: pointer; | ||
} | ||
|
||
.popup { | ||
border: 1px solid var(--base400); | ||
background: var(--base50); | ||
border-radius: var(--border-radius); | ||
padding: 20px; | ||
margin-top: 5px; | ||
} |
This file contains 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 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 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 |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
width: 100vw; | ||
grid-column: 1; | ||
grid-row: 1 / 2; | ||
z-index: 1; | ||
} | ||
|
||
.body { | ||
|
This file contains 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 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 |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
display: flex; | ||
flex-direction: column; | ||
padding-top: 40px; | ||
padding-right: 20px; | ||
} | ||
|
||
.content { | ||
|
Oops, something went wrong.
7be4d56
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
umami – ./
umami-app.vercel.app
umami-umami-software.vercel.app
umami-git-master-umami-software.vercel.app