Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ type ContextualBarProps = {

const ContextualBar: FC<ContextualBarProps> = ({ chatReload }) => {
const page = useRouteParameter('page');
const bar = useRouteParameter('bar');

if (!bar) {
return null;
}

switch (page) {
case 'contacts':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ import ContactTab from './contacts/ContactTab';
const DEFAULT_TAB = 'contacts';

const OmnichannelDirectoryPage = (): ReactElement => {
const t = useTranslation();
const router = useRouter();
const page = useRouteParameter('page');
const bar = useRouteParameter('bar');
const canViewDirectory = usePermission('view-omnichannel-contact-center');

useEffect(
Expand All @@ -38,8 +40,6 @@ const OmnichannelDirectoryPage = (): ReactElement => {

const chatReload = () => queryClient.invalidateQueries({ queryKey: ['current-chats'] });

const t = useTranslation();

if (!canViewDirectory) {
return <NotAuthorizedPage />;
}
Expand All @@ -63,9 +63,11 @@ const OmnichannelDirectoryPage = (): ReactElement => {
{(page === 'contacts' && <ContactTab />) || (page === 'chats' && <ChatTab />) || (page === 'calls' && <CallTab />)}
</PageContent>
</Page>
<ContextualbarDialog>
<ContextualBar chatReload={chatReload} />
</ContextualbarDialog>
{bar && (
<ContextualbarDialog>
<ContextualBar chatReload={chatReload} />
</ContextualbarDialog>
)}
</Page>
);
};
Expand Down