Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Merge branch 'master' into dev

Mike Caoc51dd7e60620
diff --cc .github/workflows/cd.yml
index cf275cb87,051d24a22..5a529a6c5
--- a/.github/workflows/cd.yml
+++ b/.github/workflows/cd.yml
@@@ -10,32 -28,33 +28,33 @@@ jobs
strategy:
matrix:
- db-type: [postgresql, mysql]
+ db-type: [postgresql]
steps:
- - uses: actions/checkout@v3
-
- - name: Set env
- run: |
- echo "NOW=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
-
- - name: Generate tags
- id: generate_tags
- run: |
- echo "tag_patch=$(echo ${{ matrix.db-type }})-${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- echo "tag_minor=$(echo ${{ matrix.db-type }})-$(echo ${GITHUB_REF#refs/tags/} | cut -d. -f1,2)" >> $GITHUB_ENV
- echo "tag_major=$(echo ${{ matrix.db-type }})-$(echo ${GITHUB_REF#refs/tags/} | cut -d. -f1)" >> $GITHUB_ENV
- echo "tag_latest=$(echo ${{ matrix.db-type }})-latest" >> $GITHUB_ENV
-
- - uses: mr-smithers-excellent/docker-build-push@v6
- name: Build & push Docker image to ghcr.io for ${{ matrix.db-type }}
+ - uses: actions/checkout@v5
+
+ # Install the cosign tool except on PR
+ # https://github.com/sigstore/cosign-installer
+ - name: Install cosign
+ if: github.event_name != 'pull_request'
+ uses: sigstore/cosign-installer@v3
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Log into registry docker.io
- if: github.event_name != 'pull_request' && github.repository == 'umami-software/umami'
++ if: github.event_name != 'pull_request' && github.repository == 'umami-software/umami'
+ uses: docker/login-action@v3
+ with:
+ registry: docker.io
+ username: ${{ secrets.DOCKER_USERNAME }}
+ password: ${{ secrets.DOCKER_PASSWORD }}
+
- - name: Log into ghcr registry
++ - name: Log into ghcr registry
+ if: github.event_name != 'pull_request'
+ uses: docker/login-action@v3
with:
- image: umami
- tags: ${{ env.tag_major }}, ${{ env.tag_minor }}, ${{ env.tag_patch }}, ${{ env.tag_latest }}
- buildArgs: DATABASE_TYPE=${{ matrix.db-type }}
registry: ghcr.io
- multiPlatform: true
- platform: linux/amd64,linux/arm64
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
diff --cc .github/workflows/ci.yml
index 88a922e34,d2e027cfb..eee0a02d3
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@@ -14,8 -18,12 +14,9 @@@ jobs
strategy:
matrix:
include:
- - node-version: 18.18
- db-type: postgresql
+ - node-version: 18.18
+ pnpm-version: 10
+ db-type: postgresql
- - node-version: 18.18
- pnpm-version: 10
- db-type: mysql
steps:
- uses: actions/checkout@v4
diff --cc src/components/input/SettingsButton.tsx
index 275fab07f,d3dc471fa..23ad91d31
--- a/src/components/input/SettingsButton.tsx
+++ b/src/components/input/SettingsButton.tsx
@@@ -1,72 -1,32 +1,84 @@@
-import { Button, Icon, PopupTrigger, Popup, Form, FormRow } from 'react-basics';
-import TimezoneSetting from '@/app/(main)/profile/TimezoneSetting';
-import DateRangeSetting from '@/app/(main)/profile/DateRangeSetting';
-import Icons from '@/components/icons';
-import { useMessages } from '@/components/hooks';
-import styles from './SettingsButton.module.css';
+import { Key } from 'react';
+import {
+ Icon,
+ Button,
+ MenuTrigger,
+ Popover,
+ Menu,
+ MenuItem,
+ MenuSeparator,
+ MenuSection,
+} from '@umami/react-zen';
+import { useMessages, useLoginQuery, useNavigation, useConfig } from '@/components/hooks';
- import { LogOut, LockKeyhole, Settings, UserCircle, LifeBuoy, BookText } from '@/components/icons';
++import {
++ LogOut,
++ LockKeyhole,
++ Settings,
++ UserCircle,
++ LifeBuoy,
++ BookText,
++ ExternalLink,
++} from '@/components/icons';
+import { DOCS_URL } from '@/lib/constants';
export function SettingsButton() {
const { formatMessage, labels } = useMessages();
+ const { user } = useLoginQuery();
+ const { router } = useNavigation();
+ const { cloudMode } = useConfig();
+
+ const handleAction = (id: Key) => {
+ const url = id.toString();
+
+ if (cloudMode) {
+ if (url === '/docs') {
+ window.open(DOCS_URL, '_blank');
+ } else {
+ window.location.href = url;
+ }
+ } else {
+ router.push(url);
+ }
+ };
return (
- <PopupTrigger>
- <Button variant="quiet">
+ <MenuTrigger>
+ <Button data-test="button-profile" variant="quiet" autoFocus={false}>
<Icon>
- <Icons.Gear />
+ <UserCircle />
</Icon>
</Button>
- <Popup className={styles.popup} position="bottom" alignment="end">
- <Form>
- <FormRow label={formatMessage(labels.timezone)}>
- <TimezoneSetting />
- </FormRow>
- <FormRow label={formatMessage(labels.defaultDateRange)}>
- <DateRangeSetting />
- </FormRow>
- </Form>
- </Popup>
- </PopupTrigger>
+ <Popover placement="bottom end">
+ <Menu autoFocus="last" onAction={handleAction}>
+ <MenuSection title={user.username}>
+ <MenuSeparator />
+ <MenuItem id="/settings" icon={<Settings />} label={formatMessage(labels.settings)} />
+ {!cloudMode && user.isAdmin && (
+ <MenuItem id="/admin" icon={<LockKeyhole />} label={formatMessage(labels.admin)} />
+ )}
+ {cloudMode && (
+ <>
+ <MenuItem
+ id="/docs"
+ icon={<BookText />}
+ label={formatMessage(labels.documentation)}
- />
++ >
++ <Icon color="muted">
++ <ExternalLink />
++ </Icon>
++ </MenuItem>
+ <MenuItem
+ id="/settings/support"
+ icon={<LifeBuoy />}
+ label={formatMessage(labels.support)}
+ />
+ </>
+ )}
+ <MenuSeparator />
+ <MenuItem id="/logout" icon={<LogOut />} label={formatMessage(labels.logout)} />
+ </MenuSection>
+ </Menu>
+ </Popover>
+ </MenuTrigger>
);
}
-
-export default SettingsButton;