Roadmap to becoming a developer in 2022
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

195 lines
5.1 KiB

import { useEffect, useState } from 'react';
import { httpGet, httpPatch, httpPost } from '../lib/http';
import { sponsorHidden } from '../stores/page';
import { useStore } from '@nanostores/react';
import { X } from 'lucide-react';
import { setViewSponsorCookie } from '../lib/jwt';
feat: implement mobile impressions (#5818) * add resource link for React Native Text component (#5773) * add resource link for React Native Text component --------- Co-authored-by: Ruslan Semagin <pixel.365.24@gmail.com> Co-authored-by: dsh <daniel.s.holdsworth@gmail.com> Co-authored-by: Ruslan Semagin <53819609+pixel365@users.noreply.github.com> Co-authored-by: Suman Kisku <sumankisku1@gmail.com> * feat: add useful links for Rust (#5781) * feat: add links about testing in Rust (#5791) * Patch 1 (#5792) Update 120-real-time-data.md (#5782) Add links to pages containing brief explanations on the topics listed here. Update well-architected framework. --------- Co-authored-by: devgru-3-2 <95485002+devgru-3-2@users.noreply.github.com> Co-authored-by: Danrley Senegalha Pires <dan.osp@outlook.com> * Fix: Standardize using "docker container ls" command when referencing listing containers (#5787) * Add reference link to React Native ImageBackground component (#5795) * add reference link to React Native ImageBackground component --------- Co-authored-by: Ruslan Semagin <pixel.365.24@gmail.com> Co-authored-by: dsh <daniel.s.holdsworth@gmail.com> Co-authored-by: Ruslan Semagin <53819609+pixel365@users.noreply.github.com> Co-authored-by: Suman Kisku <sumankisku1@gmail.com> * add links to the 'Modules and Crates' node in the Rust roadmap (#5797) * fix broken go topic (#5800) * feat: change the description and links in the 'log/slog' node (#5798) * change the description and links in the 'log/slog' node --------- Co-authored-by: dsh <daniel.s.holdsworth@gmail.com> * add links for 'awk' (#5801) * add links for 'grep' (#5808) * Update ci-cd.md (#5807) * Update Property Binding to most recent link (#5774) Update 101-property-binding.md * Added video resources for React Components (#5810) Signed-off-by: Archit Sharma <74408634+iArchitSharma@users.noreply.github.com> * Update 104-reference-vars.md (#5775) * fix: return response status code (#5815) * feat: implement topic link's label (#5817) * feat: implement mobile impressions * fix: add to the body --------- Signed-off-by: Archit Sharma <74408634+iArchitSharma@users.noreply.github.com> Co-authored-by: Juan Gerardo Eulufi Salazar <juan.eulufi.sa@gmail.com> Co-authored-by: Ruslan Semagin <pixel.365.24@gmail.com> Co-authored-by: dsh <daniel.s.holdsworth@gmail.com> Co-authored-by: Ruslan Semagin <53819609+pixel365@users.noreply.github.com> Co-authored-by: Suman Kisku <sumankisku1@gmail.com> Co-authored-by: Yash Deore <152061059+yashdeored@users.noreply.github.com> Co-authored-by: devgru-3-2 <95485002+devgru-3-2@users.noreply.github.com> Co-authored-by: Danrley Senegalha Pires <dan.osp@outlook.com> Co-authored-by: Anthony Pun <apun97@yahoo.com> Co-authored-by: Sion Kang <siontama@gmail.com> Co-authored-by: Liliana Santos <liliana.t.santos@hotmail.com> Co-authored-by: Archit Sharma <74408634+iArchitSharma@users.noreply.github.com>
9 months ago
import { isMobile } from '../lib/is-mobile';
import Cookies from 'js-cookie';
import { getUrlUtmParams } from '../lib/browser.ts';
export type PageSponsorType = {
company: string;
description: string;
gaLabel: string;
imageUrl: string;
pageUrl: string;
title: string;
url: string;
};
type V1GetSponsorResponse = {
id?: string;
href?: string;
sponsor?: PageSponsorType;
};
type PageSponsorProps = {
gaPageIdentifier?: string;
};
const CLOSE_SPONSOR_KEY = 'sponsorClosed';
function markSponsorHidden(sponsorId: string) {
Cookies.set(`${CLOSE_SPONSOR_KEY}-${sponsorId}`, '1', {
path: '/',
expires: 1,
sameSite: 'lax',
secure: true,
domain: import.meta.env.DEV ? 'localhost' : '.roadmap.sh',
});
}
function isSponsorMarkedHidden(sponsorId: string) {
return Cookies.get(`${CLOSE_SPONSOR_KEY}-${sponsorId}`) === '1';
}
export function PageSponsor(props: PageSponsorProps) {
const { gaPageIdentifier } = props;
const $isSponsorHidden = useStore(sponsorHidden);
const [sponsorId, setSponsorId] = useState<string | null>(null);
const [sponsor, setSponsor] = useState<PageSponsorType>();
useEffect(() => {
const foundUtmParams = getUrlUtmParams();
if (!foundUtmParams.utmSource) {
return;
}
localStorage.setItem('utm_params', JSON.stringify(foundUtmParams));
}, []);
const loadSponsor = async () => {
const currentPath = window.location.pathname;
if (
currentPath === '/' ||
currentPath === '/best-practices' ||
currentPath === '/roadmaps' ||
currentPath.startsWith('/guides') ||
currentPath.startsWith('/videos') ||
currentPath.startsWith('/account') ||
4 months ago
currentPath.startsWith('/team/')
) {
return;
}
const { response, error } = await httpGet<V1GetSponsorResponse>(
`${import.meta.env.PUBLIC_API_URL}/v1-get-sponsor`,
{
href: window.location.pathname,
feat: implement mobile impressions (#5818) * add resource link for React Native Text component (#5773) * add resource link for React Native Text component --------- Co-authored-by: Ruslan Semagin <pixel.365.24@gmail.com> Co-authored-by: dsh <daniel.s.holdsworth@gmail.com> Co-authored-by: Ruslan Semagin <53819609+pixel365@users.noreply.github.com> Co-authored-by: Suman Kisku <sumankisku1@gmail.com> * feat: add useful links for Rust (#5781) * feat: add links about testing in Rust (#5791) * Patch 1 (#5792) Update 120-real-time-data.md (#5782) Add links to pages containing brief explanations on the topics listed here. Update well-architected framework. --------- Co-authored-by: devgru-3-2 <95485002+devgru-3-2@users.noreply.github.com> Co-authored-by: Danrley Senegalha Pires <dan.osp@outlook.com> * Fix: Standardize using "docker container ls" command when referencing listing containers (#5787) * Add reference link to React Native ImageBackground component (#5795) * add reference link to React Native ImageBackground component --------- Co-authored-by: Ruslan Semagin <pixel.365.24@gmail.com> Co-authored-by: dsh <daniel.s.holdsworth@gmail.com> Co-authored-by: Ruslan Semagin <53819609+pixel365@users.noreply.github.com> Co-authored-by: Suman Kisku <sumankisku1@gmail.com> * add links to the 'Modules and Crates' node in the Rust roadmap (#5797) * fix broken go topic (#5800) * feat: change the description and links in the 'log/slog' node (#5798) * change the description and links in the 'log/slog' node --------- Co-authored-by: dsh <daniel.s.holdsworth@gmail.com> * add links for 'awk' (#5801) * add links for 'grep' (#5808) * Update ci-cd.md (#5807) * Update Property Binding to most recent link (#5774) Update 101-property-binding.md * Added video resources for React Components (#5810) Signed-off-by: Archit Sharma <74408634+iArchitSharma@users.noreply.github.com> * Update 104-reference-vars.md (#5775) * fix: return response status code (#5815) * feat: implement topic link's label (#5817) * feat: implement mobile impressions * fix: add to the body --------- Signed-off-by: Archit Sharma <74408634+iArchitSharma@users.noreply.github.com> Co-authored-by: Juan Gerardo Eulufi Salazar <juan.eulufi.sa@gmail.com> Co-authored-by: Ruslan Semagin <pixel.365.24@gmail.com> Co-authored-by: dsh <daniel.s.holdsworth@gmail.com> Co-authored-by: Ruslan Semagin <53819609+pixel365@users.noreply.github.com> Co-authored-by: Suman Kisku <sumankisku1@gmail.com> Co-authored-by: Yash Deore <152061059+yashdeored@users.noreply.github.com> Co-authored-by: devgru-3-2 <95485002+devgru-3-2@users.noreply.github.com> Co-authored-by: Danrley Senegalha Pires <dan.osp@outlook.com> Co-authored-by: Anthony Pun <apun97@yahoo.com> Co-authored-by: Sion Kang <siontama@gmail.com> Co-authored-by: Liliana Santos <liliana.t.santos@hotmail.com> Co-authored-by: Archit Sharma <74408634+iArchitSharma@users.noreply.github.com>
9 months ago
mobile: isMobile() ? 'true' : 'false',
},
);
if (error) {
console.error(error);
return;
}
if (
!response?.sponsor ||
!response.id ||
isSponsorMarkedHidden(response.id)
) {
return;
}
setSponsor(response.sponsor);
setSponsorId(response.id);
window.fireEvent({
category: 'SponsorImpression',
action: `${response.sponsor?.company} Impression`,
label:
response.sponsor.gaLabel ||
`${gaPageIdentifier} / ${response.sponsor?.company} Link`,
});
};
const clickSponsor = async (sponsorId: string) => {
feat: implement mobile impressions (#5818) * add resource link for React Native Text component (#5773) * add resource link for React Native Text component --------- Co-authored-by: Ruslan Semagin <pixel.365.24@gmail.com> Co-authored-by: dsh <daniel.s.holdsworth@gmail.com> Co-authored-by: Ruslan Semagin <53819609+pixel365@users.noreply.github.com> Co-authored-by: Suman Kisku <sumankisku1@gmail.com> * feat: add useful links for Rust (#5781) * feat: add links about testing in Rust (#5791) * Patch 1 (#5792) Update 120-real-time-data.md (#5782) Add links to pages containing brief explanations on the topics listed here. Update well-architected framework. --------- Co-authored-by: devgru-3-2 <95485002+devgru-3-2@users.noreply.github.com> Co-authored-by: Danrley Senegalha Pires <dan.osp@outlook.com> * Fix: Standardize using "docker container ls" command when referencing listing containers (#5787) * Add reference link to React Native ImageBackground component (#5795) * add reference link to React Native ImageBackground component --------- Co-authored-by: Ruslan Semagin <pixel.365.24@gmail.com> Co-authored-by: dsh <daniel.s.holdsworth@gmail.com> Co-authored-by: Ruslan Semagin <53819609+pixel365@users.noreply.github.com> Co-authored-by: Suman Kisku <sumankisku1@gmail.com> * add links to the 'Modules and Crates' node in the Rust roadmap (#5797) * fix broken go topic (#5800) * feat: change the description and links in the 'log/slog' node (#5798) * change the description and links in the 'log/slog' node --------- Co-authored-by: dsh <daniel.s.holdsworth@gmail.com> * add links for 'awk' (#5801) * add links for 'grep' (#5808) * Update ci-cd.md (#5807) * Update Property Binding to most recent link (#5774) Update 101-property-binding.md * Added video resources for React Components (#5810) Signed-off-by: Archit Sharma <74408634+iArchitSharma@users.noreply.github.com> * Update 104-reference-vars.md (#5775) * fix: return response status code (#5815) * feat: implement topic link's label (#5817) * feat: implement mobile impressions * fix: add to the body --------- Signed-off-by: Archit Sharma <74408634+iArchitSharma@users.noreply.github.com> Co-authored-by: Juan Gerardo Eulufi Salazar <juan.eulufi.sa@gmail.com> Co-authored-by: Ruslan Semagin <pixel.365.24@gmail.com> Co-authored-by: dsh <daniel.s.holdsworth@gmail.com> Co-authored-by: Ruslan Semagin <53819609+pixel365@users.noreply.github.com> Co-authored-by: Suman Kisku <sumankisku1@gmail.com> Co-authored-by: Yash Deore <152061059+yashdeored@users.noreply.github.com> Co-authored-by: devgru-3-2 <95485002+devgru-3-2@users.noreply.github.com> Co-authored-by: Danrley Senegalha Pires <dan.osp@outlook.com> Co-authored-by: Anthony Pun <apun97@yahoo.com> Co-authored-by: Sion Kang <siontama@gmail.com> Co-authored-by: Liliana Santos <liliana.t.santos@hotmail.com> Co-authored-by: Archit Sharma <74408634+iArchitSharma@users.noreply.github.com>
9 months ago
const clickUrl = new URL(
`${import.meta.env.PUBLIC_API_URL}/v1-view-sponsor/${sponsorId}`,
feat: implement mobile impressions (#5818) * add resource link for React Native Text component (#5773) * add resource link for React Native Text component --------- Co-authored-by: Ruslan Semagin <pixel.365.24@gmail.com> Co-authored-by: dsh <daniel.s.holdsworth@gmail.com> Co-authored-by: Ruslan Semagin <53819609+pixel365@users.noreply.github.com> Co-authored-by: Suman Kisku <sumankisku1@gmail.com> * feat: add useful links for Rust (#5781) * feat: add links about testing in Rust (#5791) * Patch 1 (#5792) Update 120-real-time-data.md (#5782) Add links to pages containing brief explanations on the topics listed here. Update well-architected framework. --------- Co-authored-by: devgru-3-2 <95485002+devgru-3-2@users.noreply.github.com> Co-authored-by: Danrley Senegalha Pires <dan.osp@outlook.com> * Fix: Standardize using "docker container ls" command when referencing listing containers (#5787) * Add reference link to React Native ImageBackground component (#5795) * add reference link to React Native ImageBackground component --------- Co-authored-by: Ruslan Semagin <pixel.365.24@gmail.com> Co-authored-by: dsh <daniel.s.holdsworth@gmail.com> Co-authored-by: Ruslan Semagin <53819609+pixel365@users.noreply.github.com> Co-authored-by: Suman Kisku <sumankisku1@gmail.com> * add links to the 'Modules and Crates' node in the Rust roadmap (#5797) * fix broken go topic (#5800) * feat: change the description and links in the 'log/slog' node (#5798) * change the description and links in the 'log/slog' node --------- Co-authored-by: dsh <daniel.s.holdsworth@gmail.com> * add links for 'awk' (#5801) * add links for 'grep' (#5808) * Update ci-cd.md (#5807) * Update Property Binding to most recent link (#5774) Update 101-property-binding.md * Added video resources for React Components (#5810) Signed-off-by: Archit Sharma <74408634+iArchitSharma@users.noreply.github.com> * Update 104-reference-vars.md (#5775) * fix: return response status code (#5815) * feat: implement topic link's label (#5817) * feat: implement mobile impressions * fix: add to the body --------- Signed-off-by: Archit Sharma <74408634+iArchitSharma@users.noreply.github.com> Co-authored-by: Juan Gerardo Eulufi Salazar <juan.eulufi.sa@gmail.com> Co-authored-by: Ruslan Semagin <pixel.365.24@gmail.com> Co-authored-by: dsh <daniel.s.holdsworth@gmail.com> Co-authored-by: Ruslan Semagin <53819609+pixel365@users.noreply.github.com> Co-authored-by: Suman Kisku <sumankisku1@gmail.com> Co-authored-by: Yash Deore <152061059+yashdeored@users.noreply.github.com> Co-authored-by: devgru-3-2 <95485002+devgru-3-2@users.noreply.github.com> Co-authored-by: Danrley Senegalha Pires <dan.osp@outlook.com> Co-authored-by: Anthony Pun <apun97@yahoo.com> Co-authored-by: Sion Kang <siontama@gmail.com> Co-authored-by: Liliana Santos <liliana.t.santos@hotmail.com> Co-authored-by: Archit Sharma <74408634+iArchitSharma@users.noreply.github.com>
9 months ago
);
const { response, error } = await httpPatch<{ status: 'ok' }>(
clickUrl.toString(),
{
mobile: isMobile(),
feat: implement mobile impressions (#5818) * add resource link for React Native Text component (#5773) * add resource link for React Native Text component --------- Co-authored-by: Ruslan Semagin <pixel.365.24@gmail.com> Co-authored-by: dsh <daniel.s.holdsworth@gmail.com> Co-authored-by: Ruslan Semagin <53819609+pixel365@users.noreply.github.com> Co-authored-by: Suman Kisku <sumankisku1@gmail.com> * feat: add useful links for Rust (#5781) * feat: add links about testing in Rust (#5791) * Patch 1 (#5792) Update 120-real-time-data.md (#5782) Add links to pages containing brief explanations on the topics listed here. Update well-architected framework. --------- Co-authored-by: devgru-3-2 <95485002+devgru-3-2@users.noreply.github.com> Co-authored-by: Danrley Senegalha Pires <dan.osp@outlook.com> * Fix: Standardize using "docker container ls" command when referencing listing containers (#5787) * Add reference link to React Native ImageBackground component (#5795) * add reference link to React Native ImageBackground component --------- Co-authored-by: Ruslan Semagin <pixel.365.24@gmail.com> Co-authored-by: dsh <daniel.s.holdsworth@gmail.com> Co-authored-by: Ruslan Semagin <53819609+pixel365@users.noreply.github.com> Co-authored-by: Suman Kisku <sumankisku1@gmail.com> * add links to the 'Modules and Crates' node in the Rust roadmap (#5797) * fix broken go topic (#5800) * feat: change the description and links in the 'log/slog' node (#5798) * change the description and links in the 'log/slog' node --------- Co-authored-by: dsh <daniel.s.holdsworth@gmail.com> * add links for 'awk' (#5801) * add links for 'grep' (#5808) * Update ci-cd.md (#5807) * Update Property Binding to most recent link (#5774) Update 101-property-binding.md * Added video resources for React Components (#5810) Signed-off-by: Archit Sharma <74408634+iArchitSharma@users.noreply.github.com> * Update 104-reference-vars.md (#5775) * fix: return response status code (#5815) * feat: implement topic link's label (#5817) * feat: implement mobile impressions * fix: add to the body --------- Signed-off-by: Archit Sharma <74408634+iArchitSharma@users.noreply.github.com> Co-authored-by: Juan Gerardo Eulufi Salazar <juan.eulufi.sa@gmail.com> Co-authored-by: Ruslan Semagin <pixel.365.24@gmail.com> Co-authored-by: dsh <daniel.s.holdsworth@gmail.com> Co-authored-by: Ruslan Semagin <53819609+pixel365@users.noreply.github.com> Co-authored-by: Suman Kisku <sumankisku1@gmail.com> Co-authored-by: Yash Deore <152061059+yashdeored@users.noreply.github.com> Co-authored-by: devgru-3-2 <95485002+devgru-3-2@users.noreply.github.com> Co-authored-by: Danrley Senegalha Pires <dan.osp@outlook.com> Co-authored-by: Anthony Pun <apun97@yahoo.com> Co-authored-by: Sion Kang <siontama@gmail.com> Co-authored-by: Liliana Santos <liliana.t.santos@hotmail.com> Co-authored-by: Archit Sharma <74408634+iArchitSharma@users.noreply.github.com>
9 months ago
},
);
if (error || !response) {
console.error(error);
return;
}
setViewSponsorCookie(sponsorId);
};
useEffect(() => {
window.setTimeout(loadSponsor);
}, []);
if ($isSponsorHidden || !sponsor) {
return null;
}
const { url, title, imageUrl, description, company, gaLabel } = sponsor;
4 months ago
const isRoadmapAd = title.toLowerCase() === 'advertise with us!';
return (
<a
href={url}
target="_blank"
rel="noopener sponsored nofollow"
className="fixed bottom-0 left-0 right-0 z-50 flex bg-white shadow-lg outline-0 outline-transparent sm:bottom-[15px] sm:left-auto sm:right-[15px] sm:max-w-[350px]"
onClick={async () => {
window.fireEvent({
category: 'SponsorClick',
action: `${company} Redirect`,
label: gaLabel || `${gaPageIdentifier} / ${company} Link`,
});
await clickSponsor(sponsorId || '');
}}
>
<span
className="absolute right-1 top-1 text-gray-400 hover:text-gray-800 sm:right-1.5 sm:top-1.5 sm:text-gray-300"
aria-label="Close"
onClick={(e) => {
e.preventDefault();
markSponsorHidden(sponsorId || '');
sponsorHidden.set(true);
}}
>
<X className="h-5 w-5 sm:h-4 sm:w-4" />
</span>
<span>
<img
src={imageUrl}
className="block h-[106px] object-cover sm:h-[153px] sm:w-[118.18px]"
alt="Sponsor Banner"
/>
</span>
<span className="flex flex-1 flex-col justify-between text-xs sm:text-sm">
<span className="p-[10px]">
<span className="mb-0.5 block font-semibold">{title}</span>
<span className="block text-gray-500">{description}</span>
</span>
4 months ago
{!isRoadmapAd && (
<>
<span className="sponsor-footer hidden sm:block">
Partner Content
</span>
<span className="block pb-1 text-center text-[10px] uppercase text-gray-400 sm:hidden">
Partner Content
</span>
</>
)}
</span>
</a>
);
}