Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "wordpress-plugins/real-cookie-banner/src/public/ts/components/config/consent/shortcode/menuList"

Index

Variables

Variables

Const ShortCodeMenuList

ShortCodeMenuList: FC = observer(() => {const { optionStore } = useStores();const {nav_menus,busyCountryBypassUpdate,others: { adminUrl }} = optionStore;const handleAdd = useCallback(async (id: string) => {try {await optionStore.addLinksToNavigationMenu(id);message.success(__("Successfully added the links to your menu!"));} catch (e) {message.error((e as any).responseJSON.message);}}, []);return (<List<typeof nav_menus[0]>loading={busyCountryBypassUpdate}itemLayout="horizontal"dataSource={nav_menus}size="small"locale={{emptyText: (<Empty description={__("No WordPress menu created yet.")}><a href={`${adminUrl}nav-menus.php`} className="button button-primary">{__("Create menu")}</a></Empty>)}}renderItem={(row) => {const { id, applied, edit_url, languages, name } = row;return (<List.Itemactions={[applied ? (<a key="apply"><CheckOutlined style={{ color: "#52c41a" }} />&nbsp;{__("Already added")}</a>) : (<a key="applied" style={{ cursor: "pointer" }} onClick={() => handleAdd(id)}>{__("Add all legal links")}</a>),<akey="edit-manually"target="_blank"href={edit_url}style={{ textDecoration: "none" }}rel="noreferrer">{__("Edit manually")}</a>]}><List.Item.Metatitle={<span>{name} {languages.length > 0 && <Tag>{languages[0].language}</Tag>}</span>}description={row.type === "legacy_nav" && Object.values(row.locations).join(", ")}/></List.Item>);}}/>);})

List all available menus and allow to add the legal links via button.

Generated using TypeDoc