Skip to content

Commit

Permalink
Merge pull request #1955 from umami-software/dev
Browse files Browse the repository at this point in the history
v2.1.0
  • Loading branch information
mikecao committed Apr 22, 2023
2 parents 71628be + 00d0421 commit 36b767a
Show file tree
Hide file tree
Showing 246 changed files with 6,517 additions and 4,209 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ Dockerfile
.gitignore
.DS_Store
node_modules
.idea
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
"import/no-anonymous-default-export": "off",
"import/no-named-as-default": "off",
"@next/next/no-img-element": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cd-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
db-type: [postgresql, mysql]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: mr-smithers-excellent/docker-build-push@v6
name: Build & push Docker image for ${{ matrix.db-type }}
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Create docker images
on: [create]

jobs:

build:
name: Build, push, and deploy
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
Expand All @@ -14,7 +13,7 @@ jobs:
db-type: [postgresql, mysql]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ node_modules
/build
/public/script.js
/geo
/dist

# misc
.DS_Store
Expand Down
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/public/
/public/script.js
2 changes: 1 addition & 1 deletion components/common/EmptyPlaceholder.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Icon, Text, Flexbox } from 'react-basics';
import Logo from 'assets/logo.svg';

function EmptyPlaceholder({ message, children }) {
export function EmptyPlaceholder({ message, children }) {
return (
<Flexbox direction="column" alignItems="center" justifyContent="center" gap={60} height={600}>
<Icon size="xl">
Expand Down
4 changes: 3 additions & 1 deletion components/common/ErrorMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Icon, Icons, Text } from 'react-basics';
import styles from './ErrorMessage.module.css';
import useMessages from 'hooks/useMessages';

export default function ErrorMessage() {
export function ErrorMessage() {
const { formatMessage, messages } = useMessages();

return (
Expand All @@ -14,3 +14,5 @@ export default function ErrorMessage() {
</div>
);
}

export default ErrorMessage;
2 changes: 1 addition & 1 deletion components/common/Favicon.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function getHostName(url) {
return match && match.length > 1 ? match[1] : null;
}

function Favicon({ domain, ...props }) {
export function Favicon({ domain, ...props }) {
const hostName = domain ? getHostName(domain) : null;

return hostName ? (
Expand Down
2 changes: 1 addition & 1 deletion components/common/Favicon.module.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.favicon {
margin-right: 8px;
margin-inline-end: 8px;
}
4 changes: 3 additions & 1 deletion components/common/FilterButtons.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ButtonGroup, Button, Flexbox } from 'react-basics';

export default function FilterButtons({ items, selectedKey, onSelect }) {
export function FilterButtons({ items, selectedKey, onSelect }) {
return (
<Flexbox justifyContent="center">
<ButtonGroup items={items} selectedKey={selectedKey} onSelect={onSelect}>
Expand All @@ -9,3 +9,5 @@ export default function FilterButtons({ items, selectedKey, onSelect }) {
</Flexbox>
);
}

export default FilterButtons;
4 changes: 3 additions & 1 deletion components/common/FilterLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import usePageQuery from 'hooks/usePageQuery';
import useMessages from 'hooks/useMessages';
import styles from './FilterLink.module.css';

export default function FilterLink({ id, value, label, externalUrl }) {
export function FilterLink({ id, value, label, externalUrl }) {
const { formatMessage, labels } = useMessages();
const { resolveUrl, query } = usePageQuery();
const active = query[id] !== undefined;
Expand Down Expand Up @@ -37,3 +37,5 @@ export default function FilterLink({ id, value, label, externalUrl }) {
</div>
);
}

export default FilterLink;
2 changes: 1 addition & 1 deletion components/common/FilterLink.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

.row .link {
display: none;
margin-left: 20px;
margin-inline-start: 20px;
}

.row .label {
Expand Down
4 changes: 3 additions & 1 deletion components/common/HamburgerButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Icons from 'components/icons';
import useMessages from 'hooks/useMessages';
import useConfig from 'hooks/useConfig';

export default function HamburgerButton() {
export function HamburgerButton() {
const { formatMessage, labels } = useMessages();
const [active, setActive] = useState(false);
const { cloudMode } = useConfig();
Expand Down Expand Up @@ -57,3 +57,5 @@ export default function HamburgerButton() {
</>
);
}

export default HamburgerButton;
4 changes: 3 additions & 1 deletion components/common/HoverTooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
import { Tooltip } from 'react-basics';
import styles from './HoverTooltip.module.css';

export default function HoverTooltip({ tooltip }) {
export function HoverTooltip({ tooltip }) {
const [position, setPosition] = useState({ x: -1000, y: -1000 });

useEffect(() => {
Expand All @@ -23,3 +23,5 @@ export default function HoverTooltip({ tooltip }) {
</div>
);
}

export default HoverTooltip;
4 changes: 3 additions & 1 deletion components/common/MobileMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useRouter } from 'next/router';
import Link from 'next/link';
import styles from './MobileMenu.module.css';

export default function MobileMenu({ items = [], onClose }) {
export function MobileMenu({ items = [], onClose }) {
const { pathname } = useRouter();

const Items = ({ items, className }) => (
Expand Down Expand Up @@ -34,3 +34,5 @@ export default function MobileMenu({ items = [], onClose }) {
</div>
);
}

export default MobileMenu;
2 changes: 1 addition & 1 deletion components/common/NoData.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import classNames from 'classnames';
import styles from './NoData.module.css';
import useMessages from 'hooks/useMessages';

function NoData({ className }) {
export function NoData({ className }) {
const { formatMessage, messages } = useMessages();

return (
Expand Down
4 changes: 3 additions & 1 deletion components/common/SettingsTable.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Table, TableHeader, TableBody, TableRow, TableCell, TableColumn } from 'react-basics';
import styles from './SettingsTable.module.css';

export default function SettingsTable({ columns = [], data = [], children, cellRender }) {
export function SettingsTable({ columns = [], data = [], children, cellRender }) {
return (
<Table columns={columns} rows={data}>
<TableHeader className={styles.header}>
Expand Down Expand Up @@ -34,3 +34,5 @@ export default function SettingsTable({ columns = [], data = [], children, cellR
</Table>
);
}

export default SettingsTable;
4 changes: 3 additions & 1 deletion components/common/UpdateNotice.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { REPO_URL, VERSION_CHECK } from 'lib/constants';
import styles from './UpdateNotice.module.css';
import useMessages from 'hooks/useMessages';

export default function UpdateNotice() {
export function UpdateNotice() {
const { formatMessage, labels, messages } = useMessages();
const { latest, checked, hasUpdate, releaseUrl } = useStore();
const [dismissed, setDismissed] = useState(false);
Expand Down Expand Up @@ -50,3 +50,5 @@ export default function UpdateNotice() {
</Row>
);
}

export default UpdateNotice;
8 changes: 4 additions & 4 deletions components/common/WorldMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import { useRouter } from 'next/router';
import { ComposableMap, Geographies, Geography, ZoomableGroup } from 'react-simple-maps';
import classNames from 'classnames';
import { colord } from 'colord';
import useTheme from 'hooks/useTheme';
import HoverTooltip from 'components/common/HoverTooltip';
import { ISO_COUNTRIES, THEME_COLORS, MAP_FILE } from 'lib/constants';
import styles from './WorldMap.module.css';
import useTheme from 'hooks/useTheme';
import useCountryNames from 'hooks/useCountryNames';
import useLocale from 'hooks/useLocale';
import HoverTooltip from './HoverTooltip';
import { formatLongNumber } from 'lib/format';
import { percentFilter } from 'lib/filters';
import styles from './WorldMap.module.css';

function WorldMap({ data, className }) {
export function WorldMap({ data, className }) {
const { basePath } = useRouter();
const [tooltip, setTooltip] = useState();
const [theme] = useTheme();
Expand Down
2 changes: 1 addition & 1 deletion components/input/DateFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import useApi from 'hooks/useApi';
import useDateRange from 'hooks/useDateRange';
import useMessages from 'hooks/useMessages';

function DateFilter({ websiteId, value, className }) {
export function DateFilter({ websiteId, value, className }) {
const { formatMessage, labels } = useMessages();
const { get } = useApi();
const [dateRange, setDateRange] = useDateRange(websiteId);
Expand Down
8 changes: 5 additions & 3 deletions components/input/LanguageButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import useLocale from 'hooks/useLocale';
import Icons from 'components/icons';
import styles from './LanguageButton.module.css';

export default function LanguageButton() {
const { locale, saveLocale } = useLocale();
export function LanguageButton() {
const { locale, saveLocale, dir } = useLocale();
const items = Object.keys(languages).map(key => ({ ...languages[key], value: key }));

function handleSelect(value) {
Expand All @@ -20,7 +20,7 @@ export default function LanguageButton() {
<Icons.Globe />
</Icon>
</Button>
<Popup position="bottom" alignment="end">
<Popup position="bottom" alignment={dir === 'rtl' ? 'start' : 'end'}>
<div className={styles.menu}>
{items.map(({ value, label }) => {
return (
Expand All @@ -43,3 +43,5 @@ export default function LanguageButton() {
</PopupTrigger>
);
}

export default LanguageButton;
4 changes: 3 additions & 1 deletion components/input/LogoutButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Button, Icon, Icons, Tooltip } from 'react-basics';
import Link from 'next/link';
import useMessages from 'hooks/useMessages';

export default function LogoutButton({ tooltipPosition = 'top' }) {
export function LogoutButton({ tooltipPosition = 'top' }) {
const { formatMessage, labels } = useMessages();
return (
<Link href="/logout">
Expand All @@ -16,3 +16,5 @@ export default function LogoutButton({ tooltipPosition = 'top' }) {
</Link>
);
}

export default LogoutButton;
8 changes: 6 additions & 2 deletions components/input/ProfileButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import useMessages from 'hooks/useMessages';
import useUser from 'hooks/useUser';
import useConfig from 'hooks/useConfig';
import styles from './ProfileButton.module.css';
import useLocale from 'hooks/useLocale';

export default function ProfileButton() {
export function ProfileButton() {
const { formatMessage, labels } = useMessages();
const { user } = useUser();
const { cloudMode } = useConfig();
const router = useRouter();
const { dir } = useLocale();

const handleSelect = key => {
if (key === 'profile') {
Expand All @@ -31,7 +33,7 @@ export default function ProfileButton() {
<Icons.ChevronDown />
</Icon>
</Button>
<Popup position="bottom" alignment="end">
<Popup position="bottom" alignment={dir === 'rtl' ? 'start' : 'end'}>
<Menu variant="popup" onSelect={handleSelect} className={styles.menu}>
<Item key="user" className={styles.item}>
<Text>{user.username}</Text>
Expand All @@ -55,3 +57,5 @@ export default function ProfileButton() {
</PopupTrigger>
);
}

export default ProfileButton;
2 changes: 1 addition & 1 deletion components/input/RefreshButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import useDateRange from 'hooks/useDateRange';
import Icons from 'components/icons';
import useMessages from 'hooks/useMessages';

function RefreshButton({ websiteId, isLoading }) {
export function RefreshButton({ websiteId, isLoading }) {
const { formatMessage, labels } = useMessages();
const [dateRange] = useDateRange(websiteId);

Expand Down
4 changes: 3 additions & 1 deletion components/input/SettingsButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Icons from 'components/icons';
import useMessages from 'hooks/useMessages';
import styles from './SettingsButton.module.css';

export default function SettingsButton() {
export function SettingsButton() {
const { formatMessage, labels } = useMessages();

return (
Expand Down Expand Up @@ -33,3 +33,5 @@ export default function SettingsButton() {
</PopupTrigger>
);
}

export default SettingsButton;
4 changes: 3 additions & 1 deletion components/input/ThemeButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import useTheme from 'hooks/useTheme';
import Icons from 'components/icons';
import styles from './ThemeButton.module.css';

export default function ThemeButton() {
export function ThemeButton() {
const [theme, setTheme] = useTheme();

const transitions = useTransition(theme, {
Expand Down Expand Up @@ -34,3 +34,5 @@ export default function ThemeButton() {
</Button>
);
}

export default ThemeButton;
4 changes: 3 additions & 1 deletion components/input/WebsiteSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Dropdown, Item } from 'react-basics';
import useApi from 'hooks/useApi';
import useMessages from 'hooks/useMessages';

export default function WebsiteSelect({ websiteId, onSelect }) {
export function WebsiteSelect({ websiteId, onSelect }) {
const { formatMessage, labels } = useMessages();
const { get, useQuery } = useApi();
const { data } = useQuery(['websites:me'], () => get('/me/websites'));
Expand All @@ -25,3 +25,5 @@ export default function WebsiteSelect({ websiteId, onSelect }) {
</Dropdown>
);
}

export default WebsiteSelect;
7 changes: 5 additions & 2 deletions components/layout/AppLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import NavBar from 'components/layout/NavBar';
import UpdateNotice from 'components/common/UpdateNotice';
import useRequireLogin from 'hooks/useRequireLogin';
import useConfig from 'hooks/useConfig';
import { CURRENT_VERSION } from 'lib/constants';
import styles from './AppLayout.module.css';

export default function AppLayout({ title, children }) {
export function AppLayout({ title, children }) {
const { user } = useRequireLogin();
const config = useConfig();
const { pathname } = useRouter();
Expand All @@ -19,7 +20,7 @@ export default function AppLayout({ title, children }) {
const allowUpdate = user?.isAdmin && !config?.updatesDisabled && !pathname.includes('/share/');

return (
<div className={styles.layout}>
<div className={styles.layout} data-app-version={CURRENT_VERSION}>
{allowUpdate && <UpdateNotice />}
<Head>
<title>{title ? `${title} | umami` : 'umami'}</title>
Expand All @@ -33,3 +34,5 @@ export default function AppLayout({ title, children }) {
</div>
);
}

export default AppLayout;
Loading

0 comments on commit 36b767a

Please sign in to comment.