|
|
@ -29,6 +29,7 @@ import { Spinner } from '../ReactIcons/Spinner'; |
|
|
|
import { GitHubIcon } from '../ReactIcons/GitHubIcon.tsx'; |
|
|
|
import { GitHubIcon } from '../ReactIcons/GitHubIcon.tsx'; |
|
|
|
import { GoogleIcon } from '../ReactIcons/GoogleIcon.tsx'; |
|
|
|
import { GoogleIcon } from '../ReactIcons/GoogleIcon.tsx'; |
|
|
|
import { YouTubeIcon } from '../ReactIcons/YouTubeIcon.tsx'; |
|
|
|
import { YouTubeIcon } from '../ReactIcons/YouTubeIcon.tsx'; |
|
|
|
|
|
|
|
import { resourceTitleFromId } from '../../lib/roadmap.ts'; |
|
|
|
|
|
|
|
|
|
|
|
type TopicDetailProps = { |
|
|
|
type TopicDetailProps = { |
|
|
|
resourceTitle?: string; |
|
|
|
resourceTitle?: string; |
|
|
@ -207,7 +208,9 @@ export function TopicDetail(props: TopicDetailProps) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const hasContent = topicHtml?.length > 0 || links?.length > 0 || topicTitle; |
|
|
|
const hasContent = topicHtml?.length > 0 || links?.length > 0 || topicTitle; |
|
|
|
const resourceTitleForSearch = resourceTitle?.toLowerCase()?.replace(/\s+?roadmap/ig, ''); |
|
|
|
const resourceTitleForSearch = resourceTitle |
|
|
|
|
|
|
|
?.toLowerCase() |
|
|
|
|
|
|
|
?.replace(/\s+?roadmap/gi, ''); |
|
|
|
const googleSearchUrl = `https://www.google.com/search?q=${topicHtmlTitle?.toLowerCase()} guide for ${resourceTitleForSearch}`; |
|
|
|
const googleSearchUrl = `https://www.google.com/search?q=${topicHtmlTitle?.toLowerCase()} guide for ${resourceTitleForSearch}`; |
|
|
|
const youtubeSearchUrl = `https://www.youtube.com/results?search_query=${topicHtmlTitle?.toLowerCase()} for ${resourceTitleForSearch}`; |
|
|
|
const youtubeSearchUrl = `https://www.youtube.com/results?search_query=${topicHtmlTitle?.toLowerCase()} for ${resourceTitleForSearch}`; |
|
|
|
|
|
|
|
|
|
|
@ -216,7 +219,7 @@ export function TopicDetail(props: TopicDetailProps) { |
|
|
|
<div |
|
|
|
<div |
|
|
|
ref={topicRef} |
|
|
|
ref={topicRef} |
|
|
|
tabIndex={0} |
|
|
|
tabIndex={0} |
|
|
|
className="fixed right-0 top-0 z-40 h-screen w-full overflow-y-auto bg-white p-4 focus:outline-0 sm:max-w-[600px] sm:p-6" |
|
|
|
className="fixed right-0 top-0 z-40 flex h-screen w-full flex-col overflow-y-auto bg-white p-4 focus:outline-0 sm:max-w-[600px] sm:p-6" |
|
|
|
> |
|
|
|
> |
|
|
|
{isLoading && ( |
|
|
|
{isLoading && ( |
|
|
|
<div className="flex w-full justify-center"> |
|
|
|
<div className="flex w-full justify-center"> |
|
|
@ -230,6 +233,7 @@ export function TopicDetail(props: TopicDetailProps) { |
|
|
|
|
|
|
|
|
|
|
|
{!isContributing && !isLoading && !error && ( |
|
|
|
{!isContributing && !isLoading && !error && ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
|
|
|
|
<div className="flex-1"> |
|
|
|
{/* Actions for the topic */} |
|
|
|
{/* Actions for the topic */} |
|
|
|
<div className="mb-2"> |
|
|
|
<div className="mb-2"> |
|
|
|
{!isEmbed && ( |
|
|
|
{!isEmbed && ( |
|
|
@ -257,7 +261,7 @@ export function TopicDetail(props: TopicDetailProps) { |
|
|
|
|
|
|
|
|
|
|
|
{/* Topic Content */} |
|
|
|
{/* Topic Content */} |
|
|
|
{hasContent ? ( |
|
|
|
{hasContent ? ( |
|
|
|
<div className="prose prose-h1:text-balance prose-quoteless prose-h1:mb-2.5 prose-h1:mt-7 prose-h2:mb-3 prose-h2:mt-0 prose-h3:mb-[5px] prose-h3:mt-[10px] prose-p:mb-2 prose-p:mt-0 prose-blockquote:font-normal prose-blockquote:not-italic prose-blockquote:text-gray-700 prose-li:m-0 prose-li:mb-0.5"> |
|
|
|
<div className="prose prose-quoteless prose-h1:mb-2.5 prose-h1:mt-7 prose-h1:text-balance prose-h2:mb-3 prose-h2:mt-0 prose-h3:mb-[5px] prose-h3:mt-[10px] prose-p:mb-2 prose-p:mt-0 prose-blockquote:font-normal prose-blockquote:not-italic prose-blockquote:text-gray-700 prose-li:m-0 prose-li:mb-0.5"> |
|
|
|
{topicTitle && <h1>{topicTitle}</h1>} |
|
|
|
{topicTitle && <h1>{topicTitle}</h1>} |
|
|
|
<div |
|
|
|
<div |
|
|
|
id="topic-content" |
|
|
|
id="topic-content" |
|
|
@ -302,16 +306,17 @@ export function TopicDetail(props: TopicDetailProps) { |
|
|
|
|
|
|
|
|
|
|
|
{/* Contribution */} |
|
|
|
{/* Contribution */} |
|
|
|
{canSubmitContribution && !hasEnoughLinks && contributionUrl && ( |
|
|
|
{canSubmitContribution && !hasEnoughLinks && contributionUrl && ( |
|
|
|
<div className="mt-8 mb-12 flex-1 border-t text-gray-400 text-sm"> |
|
|
|
<div className="mb-12 mt-3 border-t text-sm text-gray-400"> |
|
|
|
<div className='mt-3 mb-4'> |
|
|
|
<div className="mb-4 mt-3"> |
|
|
|
<p className=''> |
|
|
|
<p className=""> |
|
|
|
Can't find what you're looking for? Try these pre-filled search queries: |
|
|
|
Can't find what you're looking for? Try these pre-filled |
|
|
|
|
|
|
|
search queries: |
|
|
|
</p> |
|
|
|
</p> |
|
|
|
<div className="mt-3 flex gap-2 text-gray-700"> |
|
|
|
<div className="mt-3 flex gap-2 text-gray-700"> |
|
|
|
<a |
|
|
|
<a |
|
|
|
href={googleSearchUrl} |
|
|
|
href={googleSearchUrl} |
|
|
|
target="_blank" |
|
|
|
target="_blank" |
|
|
|
className="text-xs flex items-center gap-2 rounded-md border border-gray-300 px-3 py-1.5 pl-2 hover:border-gray-700 hover:bg-gray-100" |
|
|
|
className="flex items-center gap-2 rounded-md border border-gray-300 px-3 py-1.5 pl-2 text-xs hover:border-gray-700 hover:bg-gray-100" |
|
|
|
> |
|
|
|
> |
|
|
|
<GoogleIcon className={'h-4 w-4'} /> |
|
|
|
<GoogleIcon className={'h-4 w-4'} /> |
|
|
|
Google |
|
|
|
Google |
|
|
@ -319,7 +324,7 @@ export function TopicDetail(props: TopicDetailProps) { |
|
|
|
<a |
|
|
|
<a |
|
|
|
href={youtubeSearchUrl} |
|
|
|
href={youtubeSearchUrl} |
|
|
|
target="_blank" |
|
|
|
target="_blank" |
|
|
|
className="text-xs flex items-center gap-2 rounded-md border border-gray-300 px-3 py-1.5 pl-2 hover:border-gray-700 hover:bg-gray-100" |
|
|
|
className="flex items-center gap-2 rounded-md border border-gray-300 px-3 py-1.5 pl-2 text-xs hover:border-gray-700 hover:bg-gray-100" |
|
|
|
> |
|
|
|
> |
|
|
|
<YouTubeIcon className={'h-4 w-4 text-red-500'} /> |
|
|
|
<YouTubeIcon className={'h-4 w-4 text-red-500'} /> |
|
|
|
YouTube |
|
|
|
YouTube |
|
|
@ -328,9 +333,9 @@ export function TopicDetail(props: TopicDetailProps) { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<p className="mb-2 mt-2 leading-relaxed"> |
|
|
|
<p className="mb-2 mt-2 leading-relaxed"> |
|
|
|
Help us improve this introduction and submit a link to a good |
|
|
|
Help us improve this introduction and submit a link to a |
|
|
|
article, podcast, video, or any other self-vetted resource that helped you |
|
|
|
good article, podcast, video, or any other self-vetted |
|
|
|
understand this topic better. |
|
|
|
resource that helped you understand this topic better. |
|
|
|
</p> |
|
|
|
</p> |
|
|
|
<a |
|
|
|
<a |
|
|
|
href={contributionUrl} |
|
|
|
href={contributionUrl} |
|
|
@ -342,6 +347,35 @@ export function TopicDetail(props: TopicDetailProps) { |
|
|
|
</a> |
|
|
|
</a> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
)} |
|
|
|
)} |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
{resourceId === 'devops' && ( |
|
|
|
|
|
|
|
<div className="mt-4"> |
|
|
|
|
|
|
|
<a |
|
|
|
|
|
|
|
href={'https://thenewstack.io'} |
|
|
|
|
|
|
|
target="_blank" |
|
|
|
|
|
|
|
className="hidden rounded-md border bg-gray-200 px-2 py-2 text-sm hover:bg-gray-300 sm:block" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<span className="badge mr-1.5">Partner</span> |
|
|
|
|
|
|
|
Get the latest {resourceTitleFromId(resourceId)} news from our |
|
|
|
|
|
|
|
sister site{' '} |
|
|
|
|
|
|
|
<span className="font-medium underline underline-offset-1"> |
|
|
|
|
|
|
|
TheNewStack.io |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
</a> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a |
|
|
|
|
|
|
|
href={'https://thenewstack.io'} |
|
|
|
|
|
|
|
className="hidden rounded-md border bg-gray-200 px-2 py-1.5 text-sm hover:bg-gray-300 min-[390px]:block sm:hidden" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<span className="badge mr-1.5">Partner</span> |
|
|
|
|
|
|
|
Visit{' '} |
|
|
|
|
|
|
|
<span className="font-medium underline underline-offset-1"> |
|
|
|
|
|
|
|
TheNewStack.io |
|
|
|
|
|
|
|
</span>{' '} |
|
|
|
|
|
|
|
for {resourceTitleFromId(resourceId)} news |
|
|
|
|
|
|
|
</a> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
)} |
|
|
|
</> |
|
|
|
</> |
|
|
|
)} |
|
|
|
)} |
|
|
|
|
|
|
|
|
|
|
|