mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 15:17:23 +01:00
Merge branch 'dev' into dash-inactive
This commit is contained in:
commit
65d09a57d1
15 changed files with 529 additions and 458 deletions
|
|
@ -10,6 +10,8 @@ import TeamsButton from 'components/input/TeamsButton';
|
|||
import Icons from 'components/icons';
|
||||
import { useMessages, useNavigation, useTeamUrl } from 'components/hooks';
|
||||
import styles from './NavBar.module.css';
|
||||
import { useEffect } from 'react';
|
||||
import { getItem, setItem } from 'next-basics';
|
||||
|
||||
export function NavBar() {
|
||||
const { formatMessage, labels } = useMessages();
|
||||
|
|
@ -74,10 +76,21 @@ export function NavBar() {
|
|||
|
||||
const handleTeamChange = (teamId: string) => {
|
||||
const url = teamId ? `/teams/${teamId}` : '/';
|
||||
|
||||
setItem('umami.team', { id: teamId });
|
||||
router.push(cloudMode ? `${process.env.cloudUrl}${url}` : url);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const teamIdLocal = getItem('umami.team')?.id;
|
||||
if (teamIdLocal && pathname !== '/' && pathname !== '/dashboard') {
|
||||
const url = '/';
|
||||
router.push(cloudMode ? `${process.env.cloudUrl}${url}` : url);
|
||||
} else if (teamIdLocal) {
|
||||
const url = `/teams/${teamIdLocal}/dashboard`;
|
||||
router.push(cloudMode ? `${process.env.cloudUrl}${url}` : url);
|
||||
}
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className={styles.navbar}>
|
||||
<div className={styles.logo}>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useState, useMemo } from 'react';
|
||||
import { useState, useMemo, useEffect } from 'react';
|
||||
import { DragDropContext, Draggable, Droppable } from 'react-beautiful-dnd';
|
||||
import classNames from 'classnames';
|
||||
import { Button, Loading } from 'react-basics';
|
||||
|
|
@ -16,12 +16,25 @@ export function DashboardEdit({ teamId }: { teamId: string }) {
|
|||
const { formatMessage, labels } = useMessages();
|
||||
const [order, setOrder] = useState(websiteOrder || []);
|
||||
const [active, setActive] = useState(websiteActive || []);
|
||||
const [websites, setWebsites] = useState([]);
|
||||
|
||||
const {
|
||||
result,
|
||||
query: { isLoading },
|
||||
setParams,
|
||||
} = useWebsites({ teamId });
|
||||
|
||||
const websites = result?.data;
|
||||
useEffect(() => {
|
||||
if (result?.data) {
|
||||
setWebsites(prevWebsites => {
|
||||
const newWebsites = [...prevWebsites, ...result.data];
|
||||
if (newWebsites.length < result.count) {
|
||||
setParams(prevParams => ({ ...prevParams, page: prevParams.page + 1 }));
|
||||
}
|
||||
return newWebsites;
|
||||
});
|
||||
}
|
||||
}, [result]);
|
||||
|
||||
const ordered = useMemo(() => {
|
||||
if (websites) {
|
||||
|
|
|
|||
|
|
@ -59,5 +59,6 @@
|
|||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-inline-end: 0;
|
||||
z-index: 10;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue