mirror of
https://github.com/umami-software/umami.git
synced 2026-02-12 08:37:13 +01:00
Allow hiding of create team button.
This commit is contained in:
parent
4625a335a0
commit
54ace15338
2 changed files with 3 additions and 3 deletions
|
|
@ -18,7 +18,7 @@ export function TeamJoinForm({ onSave, onClose }: { onSave: () => void; onClose:
|
||||||
const { mutate, error } = useMutation({ mutationFn: (data: any) => post('/teams/join', data) });
|
const { mutate, error } = useMutation({ mutationFn: (data: any) => post('/teams/join', data) });
|
||||||
const ref = useRef(null);
|
const ref = useRef(null);
|
||||||
|
|
||||||
const handleSubmit = async data => {
|
const handleSubmit = async (data: any) => {
|
||||||
mutate(data, {
|
mutate(data, {
|
||||||
onSuccess: async () => {
|
onSuccess: async () => {
|
||||||
setValue('teams:members', Date.now());
|
setValue('teams:members', Date.now());
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import useMessages from 'components/hooks/useMessages';
|
||||||
import TeamsJoinButton from './TeamsJoinButton';
|
import TeamsJoinButton from './TeamsJoinButton';
|
||||||
import TeamsAddButton from './TeamsAddButton';
|
import TeamsAddButton from './TeamsAddButton';
|
||||||
|
|
||||||
export function TeamsHeader() {
|
export function TeamsHeader({ allowCreate = true }: { allowCreate?: boolean }) {
|
||||||
const { formatMessage, labels } = useMessages();
|
const { formatMessage, labels } = useMessages();
|
||||||
const { user } = useUser();
|
const { user } = useUser();
|
||||||
|
|
||||||
|
|
@ -15,7 +15,7 @@ export function TeamsHeader() {
|
||||||
<PageHeader title={formatMessage(labels.teams)}>
|
<PageHeader title={formatMessage(labels.teams)}>
|
||||||
<Flexbox gap={10}>
|
<Flexbox gap={10}>
|
||||||
<TeamsJoinButton />
|
<TeamsJoinButton />
|
||||||
{user.role !== ROLES.viewOnly && <TeamsAddButton />}
|
{allowCreate && user.role !== ROLES.viewOnly && <TeamsAddButton />}
|
||||||
</Flexbox>
|
</Flexbox>
|
||||||
</PageHeader>
|
</PageHeader>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue