Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | 1x 1x 1x 1x | import { ListSubheader, MenuItem } from "@mui/material"; import React from "react"; import { APIOrg, APIProfile } from "../../authentication"; import { BaseConceptContainer, LOCALES } from "../../../utils"; export const showUserName = (profile: APIProfile | undefined) => { return profile ? ( <MenuItem value={profile.url}>{profile.username}(You)</MenuItem> ) : null; }; export const showOrganisationHeader = (userOrgs: APIOrg[]) => { return userOrgs.length > 0 ? ( <ListSubheader>Your Organizations</ListSubheader> ) : null; }; export const showUserOrganisations = (userOrgs: APIOrg[]) => { return userOrgs.length > 0 ? userOrgs.map(org => ( <MenuItem key={org.id} value={org.url}> {org.name} </MenuItem> )) : null; }; function pushLocale(labels: Array<JSX.Element>, value: string, label: string) { return labels.push( <MenuItem key={value} value={value} style={{ whiteSpace: "normal" }}> {label} </MenuItem> ); } export const supportedLocalesLabel = ( values: BaseConceptContainer | { default_locale: string } ) => { const labels: Array<JSX.Element> = []; LOCALES.filter( ({ value }) => value !== values.default_locale ).map(({ value, label }) => pushLocale(labels, value, label)); return labels; }; export function showDefaultLocale() { const labels: Array<JSX.Element> = []; LOCALES.map(({ value, label }) => pushLocale(labels, value, label)); return labels; } |