Skip to content
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: rename ads to showcase and remove current ongoing ads #154

Merged
merged 1 commit into from
Jan 19, 2024
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
2 changes: 0 additions & 2 deletions holy-grail-frontend/src/features/Ads/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion holy-grail-frontend/src/features/Footer/Footer.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.footer-with-ads {
.footer-with-showcase {
margin-top: 128px;
}

Expand Down
86 changes: 43 additions & 43 deletions holy-grail-frontend/src/features/Footer/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
import { useContext } from 'react';
import { Link as RouterLink } from 'react-router-dom';
import { AuthContext } from '@providers';
import { FooterAds } from '@features';
import { FooterShowcase } from '@features';
import './Footer.css';

export const Footer = () => {
const { user } = useContext(AuthContext);

return (
<div className='footer-with-ads'>
<FooterAds />
<footer className='footer'>
<div className='footer-logo-section'>
<img
className='footer-logo-image'
src='https://document.grail.moe/grail-chan-happy.png'
alt=''
/>
</div>
<div className='footer-container'>
<div>
<div className='footer-title'>Information</div>
<div className='footer-content'>
<RouterLink to='/#home'>Home</RouterLink>
</div>
<div className='footer-content'>
<RouterLink to='/library'>Library</RouterLink>
</div>
<div className='footer-content'>
<RouterLink to='/#FAQ'>FAQ</RouterLink>
</div>
// <div className='footer-with-showcase'>
// <FooterShowcase />
<footer className='footer'>
<div className='footer-logo-section'>
<img
className='footer-logo-image'
src='https://document.grail.moe/grail-chan-happy.png'
alt=''
/>
</div>
<div className='footer-container'>
<div>
<div className='footer-title'>Information</div>
<div className='footer-content'>
<RouterLink to='/#home'>Home</RouterLink>
</div>
<div className='footer-content'>
<RouterLink to='/library'>Library</RouterLink>
</div>
<div>
<div className='footer-title'>Contribute</div>
<div className='footer-content'>
<RouterLink to='/upload'>Upload</RouterLink>
</div>
<div className='footer-content'>
<RouterLink to='/#FAQ'>FAQ</RouterLink>
</div>
<div>
<div className='footer-title'>Account</div>
<div className='footer-content' style={user ? { display: 'none' } : undefined}>
<RouterLink to='/login'>Log In</RouterLink>
</div>
<div className='footer-content' style={user ? { display: 'none' } : undefined}>
<RouterLink to='/register'>Register</RouterLink>
</div>
<div className='footer-content' style={user ? undefined : { display: 'none' }}>
<RouterLink to='/account'>Account Settings</RouterLink>
</div>
</div>
<div>
<div className='footer-title'>Contribute</div>
<div className='footer-content'>
<RouterLink to='/upload'>Upload</RouterLink>
</div>
</div>
<div className='footer-copyright-section'>
&#169; 2023 Holy Grail Team • Questions? Contact us at [email protected]
<div>
<div className='footer-title'>Account</div>
<div className='footer-content' style={user ? { display: 'none' } : undefined}>
<RouterLink to='/login'>Log In</RouterLink>
</div>
<div className='footer-content' style={user ? { display: 'none' } : undefined}>
<RouterLink to='/register'>Register</RouterLink>
</div>
<div className='footer-content' style={user ? undefined : { display: 'none' }}>
<RouterLink to='/account'>Account Settings</RouterLink>
</div>
</div>
</footer>
</div>
</div>
<div className='footer-copyright-section'>
&#169; 2023 Holy Grail Team • Questions? Contact us at [email protected]
</div>
</footer>
// </div>
);
};
4 changes: 2 additions & 2 deletions holy-grail-frontend/src/features/Library/Library.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useNavigation } from '@utils';
import { WelcomeBackHeader, TextLink } from '@components';
import { TextAds } from '@features';
import { TextShowcase } from '@features';
import { NotesApplication } from './NotesApplication';
import './Library.css';

Expand All @@ -15,7 +15,7 @@ export const Library = () => {
<div className='library-subtitle'>
View materials or contribute <TextLink onClick={goToUploadPage}>here</TextLink> after you
have logged in (subjected to approval of administrators).
<TextAds />
{/*<TextShowcase />*/}
</div>
<NotesApplication />
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
.ads-container {
.showcase-container {
display: flex;
flex-direction: column;
justify-content: center;
gap: 16px;
}

.ads-image {
.showcase-image {
position: relative;
display: flex;
margin: auto;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useNavigation } from '@utils';
import Tooltip from '@mui/material/Tooltip';
import IconButton from '@mui/material/IconButton';
import InfoIcon from '@mui/icons-material/Info';
import './FooterAds.css';
import './FooterShowcase.css';

const ADS_IMAGE_URL = 'https://document.grail.moe/General+Paper+Ad.png';

Expand Down Expand Up @@ -52,12 +52,12 @@ const InfoButton = ({ isDesktop }: InfoButtonProps) => {
);
};

export const FooterAds = () => {
export const FooterShowcase = () => {
const { isDesktop } = useContext(MediaQueryContext);
const { goToGP } = useNavigation();
const adsRef = useRef(null);
const showcaseRef = useRef(null);

const handleAdsClick = async () => {
const handleShowcaseClick = async () => {
try {
await adClick();
} finally {
Expand All @@ -81,22 +81,22 @@ export const FooterAds = () => {
},
);

if (adsRef.current) {
observer.observe(adsRef.current);
if (showcaseRef.current) {
observer.observe(showcaseRef.current);
}

return () => {
if (adsRef.current) {
observer.unobserve(adsRef.current);
if (showcaseRef.current) {
observer.unobserve(showcaseRef.current);
}
};
}, [adsRef]);
}, [showcaseRef]);

return (
<div className='ads-container' ref={adsRef}>
<div className='ads-image'>
<a onClick={handleAdsClick} style={{ cursor: 'pointer' }}>
<img alt='GP Ads here!' src={ADS_IMAGE_URL} width={isDesktop ? '468' : '320'}></img>
<div className='showcase-container' ref={showcaseRef}>
<div className='showcase-image'>
<a onClick={handleShowcaseClick} style={{ cursor: 'pointer' }}>
<img alt='GP Showcase here!' src={ADS_IMAGE_URL} width={isDesktop ? '468' : '320'}></img>
</a>
<InfoButton isDesktop={isDesktop} />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { TextLink } from '@components';
import { useNavigation } from '@utils';
import { adClick } from '@api/analytics';

export const TextAds = () => {
export const TextShowcase = () => {
const { goToStudentsKahoot, goToSecondarySchoolBot, goToJCBot, goToJCChatBot, goToThisCounted } =
useNavigation();

const handleAdsClick = async (navigate: () => void) => {
const handleShowcaseClick = async (navigate: () => void) => {
try {
await adClick();
} finally {
Expand All @@ -18,7 +18,7 @@ export const TextAds = () => {
const handleClick = (navigate: () => void): MouseEventHandler<HTMLAnchorElement> => {
return (event) => {
event.preventDefault();
handleAdsClick(navigate);
handleShowcaseClick(navigate);
};
};

Expand Down
2 changes: 2 additions & 0 deletions holy-grail-frontend/src/features/Showcase/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './FooterShowcase';
export * from './TextShowcase';
2 changes: 1 addition & 1 deletion holy-grail-frontend/src/features/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './Ads';
export * from './Showcase';
export * from './Approval';
export * from './Common';
export * from './Developer';
Expand Down
Loading