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
13 changes: 0 additions & 13 deletions src/components/NewUpdateModal/NewUpdateModal.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,3 @@
top: 21%;
cursor: pointer;
}

.closeBtn {
border-radius: 0;
background-color: #000;
color: #fff;
margin-top: 32px;
border: 1px solid #000 !important;

&:hover {
border: 1px solid #000 !important;
color: #fff !important;
}
}
8 changes: 1 addition & 7 deletions src/components/NewUpdateModal/NewUpdateModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,7 @@ const NewUpdateModal: FC<NewUpdateModalProps> = ({ data, onClose }) => {
>
{data.description}
</ReactMarkdown>
<div className={styles.btnWrapper}>
<Button
label={closeText}
onClick={onClose}
className={styles['closeBtn']}
/>
</div>
<Button label={closeText} onClick={onClose} type={'orange'} />
</div>
</Modal>
);
Expand Down
36 changes: 17 additions & 19 deletions src/components/ToolHeader/ToolHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ const SettingsModal = dynamic(() => import('@components/SettingsModal'), {
ssr: false,
});

type ActivePage = 'uxcore' | 'uxcg' | 'uxcp' | 'uxcat' | null;

type TToolHeader = {
homepageLinkTarget?: '_blank' | '_self';
openPodcast?: boolean;
Expand Down Expand Up @@ -98,9 +100,6 @@ const ToolHeader: FC<TToolHeader> = ({
const [token, setToken] = useState<string | null>(null);
const [usernameIsTakenError, setUsernameIsTakenError] = useState('');
const [changedTitle, setChangedTitle] = useState(false);
const [activePage, setActivePage] = useState<
'uxcore' | 'uxcg' | 'uxcp' | 'uxcat'
>(null);

const {
ourProjects,
Expand Down Expand Up @@ -143,22 +142,26 @@ const ToolHeader: FC<TToolHeader> = ({
};

const title = changedTitle ? userInfo?.title : userInfo?.user?.title;
const normalizePath = (p: string) => p.replace(/\/+$/, '') || '/';

const getActiveFromPath = (pathname: string): ActivePage => {
const path = normalizePath(pathname);

const normalizedPath = pathname.replace(/\/+$/, '');
const pathnameWithBypass = /^\/uxcp$/i.test(normalizedPath)
? '/uxcp/'
: normalizedPath;
const path = pathnameWithBypass.replace(/\/+$/, '');

const getActiveFromPath = (pathname: string) => {
if (pathname.includes('/uxcore')) return 'uxcore';
if (pathname.includes('/uxcg')) return 'uxcg';
if (path.includes('/uxcp')) return 'uxcp';
if (pathname.includes('/uxcat') || pathname.includes('/user'))
const pathWithBypass = /^\/uxcp$/i.test(path) ? '/uxcp/' : path;

if (pathWithBypass.includes('/uxcore')) return 'uxcore';
if (pathWithBypass.includes('/uxcg')) return 'uxcg';
if (pathWithBypass.includes('/uxcp')) return 'uxcp';
if (pathWithBypass.includes('/uxcat') || pathWithBypass.includes('/user'))
return 'uxcat';

return null;
};

const activePage = useMemo(() => {
return getActiveFromPath(pathname);
}, [pathname]);

const openPodcastHandler = useCallback(() => {
setOpenPodcast(prev => !prev);
}, []);
Expand Down Expand Up @@ -242,11 +245,6 @@ const ToolHeader: FC<TToolHeader> = ({
}
}, [title, locale, userInfo]);

useEffect(() => {
const next = getActiveFromPath(pathname);
if (router.isReady && next) setActivePage(next);
}, [pathname, router]);

return (
<header className={cn(styles.ToolHeader, { [styles.Hidden]: hidden })}>
<div className={styles.mobile}>
Expand Down