-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed share page. Updated data tables to be responsive.
- Loading branch information
Showing
17 changed files
with
69 additions
and
54 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,25 @@ | ||
'use client'; | ||
import WebsiteDetails from '../../(main)/websites/[id]/WebsiteDetails'; | ||
import WebsiteDetails from 'app/(main)/websites/[id]/WebsiteDetails'; | ||
import useShareToken from 'components/hooks/useShareToken'; | ||
import styles from './Share.module.css'; | ||
import Page from 'components/layout/Page'; | ||
import Header from './Header'; | ||
import Footer from './Footer'; | ||
|
||
export default function ({ shareId }) { | ||
const shareToken = useShareToken(shareId); | ||
export default function Share({ shareId }) { | ||
const { shareToken, isLoading } = useShareToken(shareId); | ||
|
||
if (!shareToken) { | ||
if (isLoading || !shareToken) { | ||
return null; | ||
} | ||
|
||
return <WebsiteDetails websiteId={shareToken.websiteId} />; | ||
return ( | ||
<div className={styles.container}> | ||
<Page> | ||
<Header /> | ||
<WebsiteDetails websiteId={shareToken.websiteId} /> | ||
<Footer /> | ||
</Page> | ||
</div> | ||
); | ||
} |
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,4 @@ | ||
.container { | ||
flex: 1; | ||
min-height: calc(100vh - 200px); | ||
} |
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,5 +1,5 @@ | ||
import Share from './Share'; | ||
|
||
export default function ({ params: { id } }) { | ||
return <Share shareId={id} />; | ||
return <Share shareId={id[0]} />; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,20 @@ | ||
import { useEffect } from 'react'; | ||
import useStore, { setShareToken } from 'store/app'; | ||
import useApi from './useApi'; | ||
|
||
const selector = state => state.shareToken; | ||
|
||
export function useShareToken(shareId) { | ||
const shareToken = useStore(selector); | ||
const { get } = useApi(); | ||
const { get, useQuery } = useApi(); | ||
const { isLoading, error } = useQuery(['share', shareId], async () => { | ||
const data = await get(`/share/${shareId}`); | ||
|
||
async function loadToken(id) { | ||
const data = await get(`/share/${id}`); | ||
setShareToken(data); | ||
|
||
if (data) { | ||
setShareToken(data); | ||
} | ||
} | ||
return data; | ||
}); | ||
|
||
useEffect(() => { | ||
if (shareId) { | ||
loadToken(shareId); | ||
} | ||
}, [shareId]); | ||
|
||
return shareToken; | ||
return { shareToken, isLoading, error }; | ||
} | ||
|
||
export default useShareToken; |
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