Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "wordpress-plugins/real-cookie-banner/src/public/ts/components/config/cookies/groups/tabRouter"

Index

Variables

Const CookieGroupsTabRouter

CookieGroupsTabRouter: FC<{}> = observer(() => {const { cookieStore, optionStore } = useStores();const {essentialGroup,groups: { sortedGroups }} = cookieStore;const { params, path, isExact } = useRouteMatch<{ cookieGroup: string }>();const [isAddNewVisible, setIsAddNewVisible] = useState(false);const tab = params.cookieGroup || essentialGroup?.key.toString();const isRootQuery = !params.cookieGroup;const history = useHistory();const { bannerActive, isOnlyRcbCookieCreated, tcf } = optionStore;const { groups } = cookieStore;const ref = useCookieGroupTabSortable(!isRootQuery);const redirectToEssentialGroupIfRoot = useCallback(() => {// Initially replace current url when fetching root instead of "Essential"if (isRootQuery && cookieStore.essentialGroup) {history.replace(path.replace(":cookieGroup?", tcf ? "tcf-vendors" : cookieStore.essentialGroup.key.toString()));}}, [isRootQuery, cookieStore, tcf]);useEffect(() => {const fetch = async () => {await cookieStore.fetchGroups();redirectToEssentialGroupIfRoot();};fetch();}, []);// Avoid flickering when we click the "Cookies" tab againuseEffect(() => {redirectToEssentialGroupIfRoot();}, [isRootQuery]);return isRootQuery || sortedGroups.length === 0 ? (<Spin style={{ margin: "auto", marginTop: 15 }} />) : (<Spin spinning={groups.busy}><div ref={ref}><RouteSwitch><>{!bannerActive && !isOnlyRcbCookieCreated && (<divclassName="notice notice-warning inline below-h2 notice-alt"style={{ margin: "10px 0 0 0" }}><p>{__("The cookie banner is globally deactivated in the settings and is therefore not displayed on your website.")}{" "}&bull; <a href="#/settings">{__("Enable now")}</a></p></div>)}<TabsdestroyInactiveTabPaneactiveKey={tab}tabBarExtraContent={isExact &&["tcf-vendors"].indexOf(tab) === -1 && (<Popovervisible={isAddNewVisible}content={<CookieGroupEditForm onClose={() => setIsAddNewVisible(false)} />}placement="bottomRight"><buttonclassName="button button-primary button-large"style={{ marginTop: 6 }}onClick={() => setIsAddNewVisible(!isAddNewVisible)}>{__("Add group")}</button></Popover>)}onTabClick={(key: string) => {history.push(path.replace(":cookieGroup?", key));}}>{tcf && (<><TabPane tab={__("TCF Vendors")} key="tcf-vendors"><TcfRouter /></TabPane>{/* Divider */}<TabPane tab={<span>&bull;</span>} disabled /></>)}{sortedGroups.map((group) => (<TabPane tab={<CookieGroupTabHeadline group={group} />} key={group.key.toString()}><CookiesRouter /></TabPane>))}</Tabs></></RouteSwitch></div></Spin>);})

TabPane

TabPane: TabPane

Const TcfRouter

TcfRouter: LazyExoticComponent<(Anonymous function)> = lazy(() =>import(/* webpackChunkName: "chunk-config-tab-tcf" */ "../tcf/router").then(({ TcfRouter }) =>createSuspenseComponent("tcf", <TcfRouter />)))

Generated using TypeDoc