-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add firebase remote config #376
Open
120EE0692
wants to merge
10
commits into
Monday-Morning:main
Choose a base branch
from
120EE0692:firebase-rc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+222
−4
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b94a605
feat: add firebase remote config
120EE0692 280046f
feat: add block screen
120EE0692 d109c40
feat: add remote config to live page
120EE0692 7dce3f8
chore: rebase with main
120EE0692 8c6f9a4
chore: redirect live page (#391)
Shurtu-gal 927510d
Merge branch 'main' of https://github.com/Monday-Morning/project-tahi…
120EE0692 6874d24
chore: remove redirect to coming soon
120EE0692 6514e7f
chore: change block page message
120EE0692 8c3e2d4
feat: check firebase init
120EE0692 c3f403a
feat: set minimum fetch interval to one hour
120EE0692 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { fetchAndActivate, getValue } from 'firebase/remote-config'; | ||
import { remoteConfig } from './firebase'; | ||
|
||
export let isLivePageVisible = false; | ||
|
||
export async function initRemoteConfig() { | ||
const remote = await remoteConfig(); | ||
if (remote) { | ||
remote.settings.minimumFetchIntervalMillis = 3600000; // 3 hours,for testing set this value to 0 | ||
|
||
remote.defaultConfig = { | ||
isLivePageVisible: false, | ||
}; | ||
|
||
await fetchAndActivate(remote); | ||
|
||
isLivePageVisible = getValue(remote, 'isLivePageVisible').asBoolean(); | ||
} | ||
} | ||
initRemoteConfig(); | ||
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 |
---|---|---|
@@ -0,0 +1,175 @@ | ||
import React from 'react'; | ||
|
||
import Link from 'next/link'; | ||
import Image from 'next/image'; | ||
|
||
import { Grid, Typography } from '@mui/material'; | ||
import makeStyles from '@mui/styles/makeStyles'; | ||
import { ArrowForward } from '@mui/icons-material'; | ||
|
||
import logo from '../assets/images/logo_mm.png'; | ||
import LINKS from '../utils/getLinks'; | ||
|
||
const SOCIALS = [ | ||
{ | ||
link: 'https://www.facebook.com/mondaymorningnitr/', | ||
icons: 'fab fa-facebook-f', | ||
}, | ||
{ | ||
link: 'https://twitter.com/mmnitrkl?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor', | ||
icons: 'fab fa-twitter', | ||
}, | ||
{ | ||
link: 'https://www.youtube.com/c/MondayMorningNITR', | ||
icons: 'fab fa-youtube', | ||
}, | ||
{ | ||
link: 'https://in.linkedin.com/company/monday-morning-the-official-student-media-body-of-nit-rourkela', | ||
icons: 'fab fa-linkedin', | ||
}, | ||
{ | ||
link: 'https://www.instagram.com/mondaymorningnitrofficial/?hl=en', | ||
icons: 'fab fa-instagram', | ||
}, | ||
]; | ||
|
||
const PageNotFound = () => { | ||
const classes = useStyles(); | ||
return ( | ||
<div className={classes.root}> | ||
<Grid | ||
container | ||
direction='column' | ||
justifyContent='center' | ||
alignItems='center' | ||
> | ||
<Grid item className={classes.gridContainerLogo}> | ||
<Image src={logo} alt='MM Logo' /> | ||
</Grid> | ||
<Grid item className={classes.gridContainer}> | ||
<Typography className={classes.subTitle}>Page blocked.</Typography> | ||
<Typography className={classes.body}> | ||
This page has been temporarily closed by the{' '} | ||
<Link href={'https://website.nitrkl.ac.in/Placement/'}> | ||
<a target='_blank' rel='noreferrer'> | ||
Career Development Center of the National Institute of | ||
Technology, Rourkela. | ||
</a> | ||
</Link> | ||
120EE0692 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</Typography> | ||
</Grid> | ||
<Grid item className={classes.gridContainer}> | ||
<Link passHref href={LINKS.CATEGORIES.HOME} className={classes.link}> | ||
<Typography className={classes.homeLink}> | ||
Go back home <ArrowForward /> | ||
</Typography> | ||
</Link> | ||
</Grid> | ||
</Grid> | ||
<div className={classes.socialIcons}> | ||
{SOCIALS.map(({ icons, link }) => ( | ||
<Link key={link} href={link}> | ||
<a target='_blank' rel='noreferrer'> | ||
<span className={classes.socialIcon}> | ||
<i className={icons} /> | ||
</span> | ||
</a> | ||
</Link> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default PageNotFound; | ||
|
||
const useStyles = makeStyles((theme) => ({ | ||
root: { | ||
width: '100%', | ||
height: '100%', | ||
textAlign: 'center', | ||
display: 'flex', | ||
alignItems: 'center', | ||
flexDirection: 'column', | ||
[theme.breakpoints.down('lg')]: { | ||
padding: '20px', | ||
}, | ||
}, | ||
gridContainerLogo: { | ||
marginTop: '70px', | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
flexDirection: 'column', | ||
height: 84, | ||
width: 86, | ||
[theme.breakpoints.down('lg')]: { | ||
height: 60, | ||
width: 60, | ||
marginTop: '20px', | ||
}, | ||
}, | ||
gridContainer: { | ||
marginTop: '70px', | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
flexDirection: 'column', | ||
[theme.breakpoints.down('lg')]: { | ||
marginTop: '20px', | ||
}, | ||
}, | ||
subTitle: { | ||
fontSize: '52px', | ||
fontWeight: '700', | ||
[theme.breakpoints.down('md')]: { | ||
fontSize: '30px', | ||
}, | ||
}, | ||
body: { | ||
marginTop: '28px', | ||
fontSize: '24px', | ||
color: '#6E6E6E', | ||
[theme.breakpoints.down('md')]: { | ||
fontSize: '19px', | ||
}, | ||
[theme.breakpoints.up('sm')]: { | ||
maxWidth: '60vw', | ||
}, | ||
}, | ||
link: { | ||
cursor: 'pointer', | ||
textDecoration: 'none', | ||
}, | ||
homeLink: { | ||
fontSize: '24px', | ||
fontWeight: '600', | ||
color: '#006DCC', | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
cursor: 'default', | ||
[theme.breakpoints.down('md')]: { | ||
fontSize: '18px', | ||
}, | ||
}, | ||
socialIcons: { | ||
display: 'flex', | ||
justifyContent: 'center', | ||
alignItems: 'flex-end', | ||
marginTop: '105px', | ||
[theme.breakpoints.down('lg')]: { | ||
marginTop: '20px', | ||
}, | ||
}, | ||
socialIcon: { | ||
marginLeft: '20px', | ||
fontSize: '21px', | ||
color: '#999999', | ||
cursor: 'pointer', | ||
[theme.breakpoints.down('md')]: { | ||
marginLeft: '10px', | ||
fontSize: '15px', | ||
}, | ||
}, | ||
})); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a good practice. Make this call as part of some init firebase script where authentication and everything is being initialized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A solution would be to run this in the FirebaseContext we have wrapped over the app.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rutajdash I think this method is better as in future we may required many more values from remote config, in that case context will looked up bit messy, this style is referred from their docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then find a way to keep context clean. You never define a function and then add the call right there below it. That is a very bar practice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rutajdash where I should exactly call this.