-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(route): Intercept route for post, tmp solution, like product-hunt…
… style (#174) * refactor(dashbaord): adjust dashboard header * refactor(router): handle browser popstate back/forword
- Loading branch information
Showing
8 changed files
with
116 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use client' | ||
|
||
import ArticlePost from '@/widgets/Article/Post' | ||
|
||
const CommunityPostPage = () => { | ||
return <ArticlePost /> | ||
} | ||
|
||
export default CommunityPostPage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Default() { | ||
return null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,39 @@ | ||
'use client' | ||
|
||
import { FC } from 'react' | ||
import { FC, useEffect, useCallback } from 'react' | ||
|
||
import useViewingThread from '@/hooks/useViewingThread' | ||
import { THREAD } from '@/constant/thread' | ||
|
||
import { useStore } from './store' | ||
import { useInit } from './logic' | ||
|
||
const Mushroom: FC = () => { | ||
const store = useStore() | ||
useInit(store) | ||
const curThread = useViewingThread() | ||
|
||
const handleBrowserPopChange = useCallback( | ||
(data) => { | ||
if (curThread === THREAD.POST) { | ||
window.location = data.target.location.pathname | ||
} | ||
}, | ||
[curThread], | ||
) | ||
|
||
useEffect(() => { | ||
/** | ||
* this event is only hanle brower back/forward, current behavior is like producthunt | ||
*/ | ||
window.addEventListener('popstate', handleBrowserPopChange) | ||
|
||
return () => { | ||
window.removeEventListener('popstate', handleBrowserPopChange) | ||
} | ||
}, []) | ||
|
||
return <div /> | ||
return <></> | ||
} | ||
|
||
export default Mushroom |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters