Skip to content

Commit 4ad8c2f

Browse files
authored
Merge branch 'master' into migration/migrate-nest-server-to-netlify-functions
2 parents 6822874 + 3484e4a commit 4ad8c2f

File tree

8 files changed

+198
-35
lines changed

8 files changed

+198
-35
lines changed

pages/_app.tsx

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,29 +49,17 @@ function MyApp({ Component, pageProps }) {
4949

5050
const Scripts = () => (
5151
<>
52+
<Script
53+
async
54+
src="https://www.googletagmanager.com/gtag/js?id=G-FPJS88RWMJ"
55+
></Script>
5256
<Script id="google-analytics">
5357
{`
54-
(function (i, s, o, g, r, a, m) {
55-
i['GoogleAnalyticsObject'] = r;
56-
(i[r] =
57-
i[r] ||
58-
function () {
59-
(i[r].q = i[r].q || []).push(arguments);
60-
}),
61-
(i[r].l = 1 * new Date());
62-
(a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]);
63-
a.async = 1;
64-
a.src = g;
65-
m.parentNode.insertBefore(a, m);
66-
})(
67-
window,
68-
document,
69-
'script',
70-
'https://www.google-analytics.com/analytics.js',
71-
'ga'
72-
);
73-
ga('create', 'UA-133820299-2', 'auto');
74-
ga('send', 'pageview');
58+
window.dataLayer = window.dataLayer || [];
59+
function gtag(){dataLayer.push(arguments);}
60+
gtag('js', new Date());
61+
62+
gtag('config', 'G-0S2Z5NGKQ1');
7563
`}
7664
</Script>
7765
</>

src/components/Modal/Modal.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,20 @@ export default class Modal extends Component {
4646
onTransitionEnd={this.onTransitionEnd}
4747
>
4848
<div className="modal-box">
49-
<button className="close" onClick={this.handleClose}>
50-
<i className="fa fa-times" aria-hidden="true"></i>
51-
</button>
52-
<div className="modal-head">
53-
<h2>{title || ''}</h2>
54-
</div>
49+
{
50+
this.props.onClose && (
51+
<button className="close" onClick={this.handleClose}>
52+
<i className="fa fa-times" aria-hidden="true"></i>
53+
</button>
54+
)
55+
}
56+
{
57+
title && (
58+
<div className="modal-head">
59+
<h2>{title}</h2>
60+
</div>
61+
)
62+
}
5563
<div className="scroll-helper">
5664
<div className="modal-content">
5765
{children

src/components/layouts/App/App.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ body {
77

88
.app {
99
padding-bottom: 50px;
10+
/* TODO: remove when the app is ready */
11+
overflow: hidden;
12+
height: 100vh;
1013
}
1114

1215
.main-header {

src/components/layouts/App/App.js

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,22 @@ const App = (props) => {
5454

5555
return (
5656
<div className="app">
57+
{/* TODO: remove this modal when app is ready */}
58+
<Modal>
59+
<>
60+
<h2 style={{ color: '#69d5b1;'}}>🚀 We're Moving to a New Home!</h2>
61+
<p style={{
62+
fontSize: 'large',
63+
padding: '0 10px',
64+
lineHeight: 1.4,
65+
}}>
66+
Our digital spaceship is heading to a brand new infrastructure (to save some money and to simplify our ci-cd
67+
pipeline) but don't worry, our engineers have their coffee ready! <StayTunedLink href="https://x.com/codingcoach_io">Stay Tuned!</StayTunedLink>
68+
</p>
69+
</>
70+
</Modal>
5771
<ToastContainer />
58-
<Modal title={modal.title}>{modal.content}</Modal>
72+
<Modal title={modal?.title}>{modal?.content}</Modal>
5973
<Layout>
6074
<Header />
6175
<Body>
@@ -110,4 +124,26 @@ const Main = styled.section`
110124
}
111125
`;
112126

127+
const StayTunedLink = styled.a`
128+
border-radius: 3px;
129+
box-sizing: border-box;
130+
font-family: Lato,sans-serif;
131+
transition: box-shadow 0.1s ease-in-out;
132+
background-color: #69d5b1;
133+
color: #fff;
134+
margin: 10px auto;
135+
display: block;
136+
width: fit-content;
137+
padding: 5px 10px;
138+
text-decoration: none;
139+
140+
&:hover {
141+
box-shadow: inset 0 0 100px 0 #00000010;
142+
}
143+
144+
&:disabled {
145+
opacity: 0.5;
146+
}
147+
`;
148+
113149
export default AppWithActionHandlers;

src/context/mentorsContext/MentorsContext.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ import {
1616
updateFavMentorsForUser,
1717
} from '../../favoriteManager';
1818
import { useFilters } from '../../context/filtersContext/FiltersContext';
19+
import { mockMentors } from './mockMentors';
1920

2021
const initialState = {
2122
favorites: [],
2223
mentors: [],
2324
addFavorite: () => {},
24-
isLoading: true,
25+
// TODO: Replace isLoading with true when app is ready
26+
isLoading: false,
2527
};
2628

2729
export const MentorsContext = createContext(initialState);
@@ -30,7 +32,8 @@ export const MentorsProvider = (props) => {
3032
const { children } = props;
3133

3234
const [favorites, setFavorites] = useState([]);
33-
const [mentors, setMentors] = useState([]);
35+
// TODO: Replace mockMentors with an empty array when app is ready
36+
const [mentors, setMentors] = useState(mockMentors);
3437
const [contextState, setContextState] = useState(initialState);
3538

3639
const { currentUser } = useUser();
@@ -72,7 +75,7 @@ export const MentorsProvider = (props) => {
7275
}, [currentUser, api]);
7376

7477
useEffect(() => {
75-
initialize();
78+
// initialize();
7679
}, [initialize]);
7780

7881
const [filters] = useFilters();
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
export const mockMentors = [
2+
{
3+
"_id": "616983adaac54156d3ab5de1",
4+
"available": true,
5+
"spokenLanguages": ["en", "fr"],
6+
"tags": ["javascript", "reactjs", "nodejs", "css", "html"],
7+
"name": "Alice B Johnson",
8+
"avatar": "/avatars/a1b2c3d4e5f6g7h8i9j0",
9+
"title": "Frontend Architect",
10+
"description": "Passionate frontend engineer with expertise in React and modern web development.",
11+
"country": "CA",
12+
"createdAt": "2020-05-10T09:15:30.000Z",
13+
"channels": []
14+
},
15+
{
16+
"_id": "616983adaac54156d3ab5de2",
17+
"available": false,
18+
"spokenLanguages": ["en", "de"],
19+
"tags": ["python", "django", "flask", "sql", "cloud"],
20+
"name": "Martin Schmidt",
21+
"avatar": "/avatars/abc123def456ghi789",
22+
"title": "Backend Specialist",
23+
"description": "Experienced backend engineer with a focus on Python and scalable web services.",
24+
"country": "DE",
25+
"createdAt": "2019-08-22T15:42:10.000Z",
26+
"channels": []
27+
},
28+
{
29+
"_id": "616983adaac54156d3ab5de4",
30+
"available": true,
31+
"spokenLanguages": ["en", "zh"],
32+
"tags": ["golang", "microservices", "cloud", "kubernetes"],
33+
"name": "Li Wei",
34+
"avatar": "/avatars/xyz987lmn654opq321",
35+
"title": "Cloud Engineer",
36+
"description": "Building scalable cloud applications with Go and Kubernetes.",
37+
"country": "CN",
38+
"createdAt": "2022-02-14T10:00:00.000Z",
39+
"channels": []
40+
},
41+
{
42+
"_id": "616983adaac54156d3ab5de5",
43+
"available": false,
44+
"spokenLanguages": ["en", "it"],
45+
"tags": ["java", "spring", "sql", "microservices"],
46+
"name": "Giovanni Rossi",
47+
"avatar": "/avatars/lmnop456rst789uvw123",
48+
"title": "Enterprise Java Developer",
49+
"description": "Building high-performance enterprise applications using Java and Spring.",
50+
"country": "IT",
51+
"createdAt": "2018-07-30T14:25:00.000Z",
52+
"channels": []
53+
},
54+
{
55+
"_id": "616983adaac54156d3ab5de6",
56+
"available": true,
57+
"spokenLanguages": ["en"],
58+
"tags": ["ruby", "rails", "postgresql", "devops"],
59+
"name": "Sophia Carter",
60+
"avatar": "/avatars/abcdef123456ghijk789",
61+
"title": "Ruby on Rails Expert",
62+
"description": "Helping startups build robust applications with Rails.",
63+
"country": "US",
64+
"createdAt": "2017-11-21T08:30:00.000Z",
65+
"channels": []
66+
},
67+
{
68+
"_id": "616983adaac54156d3ab5de7",
69+
"available": false,
70+
"spokenLanguages": ["en", "pt"],
71+
"tags": ["php", "laravel", "mysql", "api"],
72+
"name": "Carlos Mendes",
73+
"avatar": "/avatars/xyz123uvw456rst789",
74+
"title": "PHP & Laravel Developer",
75+
"description": "Specialized in building modern web applications using Laravel and PHP.",
76+
"country": "BR",
77+
"createdAt": "2021-01-10T17:45:00.000Z",
78+
"channels": []
79+
},
80+
{
81+
"_id": "616983adaac54156d3ab5de8",
82+
"available": true,
83+
"spokenLanguages": ["en", "ru"],
84+
"tags": ["c++", "game development", "unity", "opengl"],
85+
"name": "Ivan Petrov",
86+
"avatar": "/avatars/asdf1234ghjk5678lmno",
87+
"title": "Game Developer",
88+
"description": "Passionate about creating immersive gaming experiences with C++ and Unity.",
89+
"country": "RU",
90+
"createdAt": "2020-06-18T12:20:00.000Z",
91+
"channels": []
92+
},
93+
{
94+
"_id": "616983adaac54156d3ab5de9",
95+
"available": false,
96+
"spokenLanguages": ["en", "ja"],
97+
"tags": ["typescript", "vuejs", "nuxtjs", "frontend"],
98+
"name": "Haruto Tanaka",
99+
"avatar": "/avatars/jklm456nopq789rst123",
100+
"title": "Vue.js Frontend Engineer",
101+
"description": "Expert in building modern frontend applications with Vue.js and Nuxt.js.",
102+
"country": "JP",
103+
"createdAt": "2019-12-05T16:10:00.000Z",
104+
"channels": []
105+
},
106+
{
107+
"_id": "616983adaac54156d3ab5dea",
108+
"available": true,
109+
"spokenLanguages": ["en", "ar"],
110+
"tags": ["flutter", "dart", "mobile development"],
111+
"name": "Amira Khaled",
112+
"avatar": "/avatars/uvwxyz123456abcd789",
113+
"title": "Mobile App Developer",
114+
"description": "Building beautiful and efficient mobile apps with Flutter.",
115+
"country": "EG",
116+
"createdAt": "2023-03-01T09:00:00.000Z",
117+
"channels": []
118+
}
119+
]

src/external-types.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { TawkAPI } from './utils/tawk';
33
export declare global {
44
interface Window {
55
Tawk_API: TawkAPI;
6-
ga(operation: 'send', event: 'pageview'): void;
7-
ga(operation: 'send', event: 'event', category: string, action: string, label?: string): void;
6+
gtag(command: 'config', targetId: string, config?: Record<string, any>): void;
7+
gtag(command: 'event', eventName: string, params?: Record<string, any>): void;
88
}
99
}

src/ga.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,20 @@ export function report(category: string, action: string, label?: string) {
88
console.log({ category, action, label });
99
return;
1010
}
11-
window.ga('send', 'event', category, action, label);
11+
window.gtag('event', action, {
12+
event_category: category,
13+
event_label: label,
14+
});
1215
}
1316

1417
export function reportPageView() {
1518
if (!shouldReport()) {
1619
return;
1720
}
18-
window.ga('send', 'pageview');
21+
window.gtag('event', 'page_view', {
22+
page_path: window.location.pathname,
23+
page_title: document.title,
24+
});
1925
}
2026

2127
export function reportError(category: string, label: string) {

0 commit comments

Comments
 (0)