Skip to content

Commit

Permalink
refactor: naming changes + conditional rendering for the button
Browse files Browse the repository at this point in the history
  • Loading branch information
kKaskak committed Dec 14, 2023
1 parent 179ed39 commit cd8be46
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
17 changes: 11 additions & 6 deletions src/routes/Board/Board.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const { MainNavBars, MetaRow, ContinueWatchingItem, MetaItem, StreamingServerWar
const useBoard = require('./useBoard');
const useContinueWatchingPreview = require('./useContinueWatchingPreview');
const styles = require('./styles');
const useFetchModalData = require('./useFetchModalData');
const useFetchNotificationData = require('./useFetchNotificationData');

const THRESHOLD = 5;

Expand All @@ -19,8 +19,8 @@ const Board = () => {
const [board, loadBoardRows] = useBoard();
const boardCatalogsOffset = continueWatchingPreview.items.length > 0 ? 1 : 0;
const scrollContainerRef = React.useRef();
const { notificationModalData, isModalDataLoading } = useFetchModalData();
const [isNotificationModalOpen, , closeNotificationModal, ] = useBinaryState(true);
const { notificationModalData, isModalDataLoading } = useFetchNotificationData();
const [isNotificationModalOpen, , closeNotificationModal] = useBinaryState(true);
const onVisibleRangeChange = React.useCallback(() => {
const range = getVisibleChildrenRange(scrollContainerRef.current);
if (range === null) {
Expand Down Expand Up @@ -65,9 +65,14 @@ const Board = () => {
null
}
</div>
<Button className={styles['action-button']}>
<div className={styles['label']}>Learn more</div>
</Button>
{
notificationModalData.addon.manifestUrl ?
<Button className={styles['action-button']} href={notificationModalData.addon.manifestUrl}>
<div className={styles['label']}>Learn more</div>
</Button>
:
null
}
</div>
</ModalDialog>
:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const React = require('react');

const useFetchModalData = () => {
const useFetchNotificationData = () => {
const [notificationModalData, setNotificationModalData] = React.useState(null);
const [isLoading, setIsLoading] = React.useState(false);

Expand Down Expand Up @@ -38,4 +38,4 @@ const useFetchModalData = () => {
return { notificationModalData, isLoading };
};

module.exports = useFetchModalData;
module.exports = useFetchNotificationData;

0 comments on commit cd8be46

Please sign in to comment.