Skip to content

Commit 8f7282a

Browse files
committed
fixes
1 parent 92c81a8 commit 8f7282a

File tree

19 files changed

+191
-36
lines changed

19 files changed

+191
-36
lines changed

src/components/DiscourseComment/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ export default function DiscourseComment(props) {
55
const { postUrl } = props
66
useEffect(() => {
77
const url = window.location.href
8-
if (!url.includes('https://web3auth.io/')) {
8+
if (!url.includes('https://metamask.io/')) {
99
return
1010
} else {
1111
window.DiscourseEmbed = {
12-
discourseUrl: 'https://web3auth.io/community/',
12+
discourseUrl: 'https://builder.metamask.io/',
1313
discourseEmbedUrl: postUrl,
1414
}
1515

src/components/PregenerateWallet/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default function LookupAPIPage() {
3333

3434
const [formData, setFormData] = useState({
3535
verifier: 'w3a-google-demo',
36-
verifierId: 'devrel@web3auth.io',
36+
verifierId: 'devrel@metamask.io',
3737
web3AuthNetwork: 'sapphire_mainnet',
3838
clientId:
3939
'BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ',

src/components/PregenrateSmartAccount/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default function LookupSCWAPIPage() {
3737

3838
const [formData, setFormData] = useState({
3939
verifier: 'w3a-google-demo',
40-
verifierId: 'devrel@web3auth.io',
40+
verifierId: 'devrel@metamask.io',
4141
web3AuthNetwork: 'sapphire_mainnet',
4242
clientId:
4343
'BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ',

src/components/SEO/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ export default function SEO(props) {
6767
<meta name="twitter:card" content="summary_large_image" />
6868
<meta name="twitter:site" content="@MetaMask" />
6969
<meta name="twitter:creator" content="@MetaMask" />
70-
{/* {title ? <meta name="twitter:title" content={title} /> : <meta name="twitter:title" content="Documentation | Web3Auth" />}
70+
{title ? <meta name="twitter:title" content={title} /> : <meta name="twitter:title" content="Documentation | MetaMask" />}
7171
{description ? (
7272
<meta name="twitter:description" content={description} />
7373
) : (
7474
<meta
7575
name="twitter:description"
76-
content="Web3Auth is simple, non-custodial auth infrastructure that enables Web3 wallets and applications to provide seamless user logins for both mainstream and native Web3 users."
76+
content="MetaMask is the leading self-custodial wallet. Build with the world's leading self-custodial crypto wallet through MetaMask developer documentation."
7777
/>
78-
)} */}
78+
)}
7979
{image ? (
8080
<meta name="twitter:image" content={image} />
8181
) : (

src/components/GuidesPage/GuideCard.tsx renamed to src/components/TutorialsPage/GuideCard.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Badge from '@site/src/components/Badge'
44
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'
55
import styles from './GuideCard.module.css'
66

7-
interface GuideCardProps {
7+
interface TutorialCardProps {
88
title: string
99
description: string
1010
link: string
@@ -17,7 +17,7 @@ interface GuideCardProps {
1717
activeTags?: string[]
1818
}
1919

20-
export default function GuideCard({
20+
export default function TutorialCard({
2121
title,
2222
description,
2323
link,
@@ -28,7 +28,7 @@ export default function GuideCard({
2828
type,
2929
searchInput = '',
3030
activeTags = [],
31-
}: GuideCardProps) {
31+
}: TutorialCardProps) {
3232
const { siteConfig } = useDocusaurusContext()
3333
const { baseUrl } = siteConfig
3434

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
import React from 'react'
2+
import Link from '@docusaurus/Link'
3+
import Badge from '@site/src/components/Badge'
4+
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'
5+
import styles from './TutorialCard.module.css'
6+
7+
interface TutorialCardProps {
8+
title: string
9+
description: string
10+
link: string
11+
image?: string
12+
tags?: string[]
13+
author?: string
14+
date?: string
15+
type?: string
16+
searchInput?: string
17+
activeTags?: string[]
18+
}
19+
20+
export default function TutorialCard({
21+
title,
22+
description,
23+
link,
24+
image,
25+
tags = [],
26+
author,
27+
date,
28+
type,
29+
searchInput = '',
30+
activeTags = [],
31+
}: TutorialCardProps) {
32+
const { siteConfig } = useDocusaurusContext()
33+
const { baseUrl } = siteConfig
34+
35+
function highlightSearchText(text: string) {
36+
if (!searchInput.trim()) {
37+
return text
38+
}
39+
40+
const searchTerms = searchInput.trim().split(/\s+/)
41+
const regex = new RegExp(`(${searchTerms.join('|')})`, 'gi')
42+
43+
// Use replace to find matches and build result
44+
let lastIndex = 0
45+
const elements: React.ReactNode[] = []
46+
let match
47+
48+
// Reset regex lastIndex to avoid stateful issues
49+
regex.lastIndex = 0
50+
51+
while ((match = regex.exec(text)) !== null) {
52+
// Add text before the match
53+
if (match.index > lastIndex) {
54+
elements.push(text.slice(lastIndex, match.index))
55+
}
56+
57+
// Add the highlighted match
58+
elements.push(<mark key={match.index}>{match[0]}</mark>)
59+
60+
lastIndex = match.index + match[0].length
61+
62+
// Prevent infinite loop with zero-length matches
63+
if (match.index === regex.lastIndex) {
64+
regex.lastIndex++
65+
}
66+
}
67+
68+
// Add remaining text after last match
69+
if (lastIndex < text.length) {
70+
elements.push(text.slice(lastIndex))
71+
}
72+
73+
return <span>{elements}</span>
74+
}
75+
76+
return (
77+
<article className={styles.card}>
78+
<Link to={link} className={styles.cardLink}>
79+
{image && (
80+
<div className={styles.imageContainer}>
81+
<img src={baseUrl + image} alt={title} className={styles.image} />
82+
</div>
83+
)}
84+
85+
<div className={styles.content}>
86+
<h3 className={styles.title}>{highlightSearchText(title)}</h3>
87+
<p className={styles.description}>{highlightSearchText(description)}</p>
88+
</div>
89+
</Link>
90+
91+
{tags.length > 0 && (
92+
<div className={styles.tagsContainer}>
93+
{tags.map(tag => (
94+
<Badge
95+
key={tag}
96+
label={tag.toLowerCase()}
97+
variant={activeTags.includes(tag) ? 'success' : 'default'}
98+
/>
99+
))}
100+
</div>
101+
)}
102+
103+
{(author || date) && (
104+
<div className={styles.meta}>{author && date && `${author} | ${date}`}</div>
105+
)}
106+
</article>
107+
)
108+
}

src/components/GuidesPage/index.tsx renamed to src/components/TutorialsPage/index.tsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@
55
/* eslint-disable jsx-a11y/no-static-element-interactions */
66
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'
77
import Layout from '@theme/Layout'
8-
import { GuidesInterface, platformMap, productMap } from '../../utils/guides-map'
8+
import { TutorialsInterface, platformMap, productMap } from '../../utils/tutorials-map'
99

1010
import { useState, useEffect } from 'react'
1111
import SEO from '@site/src/components/SEO'
1212
import Hero from '@site/src/components/Hero/Hero'
1313
import Input from '@site/src/components/Input'
14-
import GuideCard from './GuideCard'
14+
import TutorialCard from './TutorialCard'
1515
import CustomSelect, { OptionType } from './CustomSelect'
1616
import styles from './styles.module.css'
1717

18-
export default function Guides({ content = {} }: GuidesInterface) {
18+
export default function Tutorials({ content = {} }: TutorialsInterface) {
1919
const safeContent = content || {}
2020

21-
const completeGuides = Object.entries(safeContent)
21+
const completeTutorials = Object.entries(safeContent)
2222
.map(([key, value]) => {
2323
return { ...value, link: `/tutorials/${key}` }
2424
})
@@ -37,16 +37,16 @@ export default function Guides({ content = {} }: GuidesInterface) {
3737
const [platformFilter, setPlatformFilter] = useState<string[]>([])
3838
const [selectedProducts, setSelectedProducts] = useState<OptionType[]>([])
3939
const [selectedPlatforms, setSelectedPlatforms] = useState<OptionType[]>([])
40-
const [filteredGuides, setFilteredGuides] = useState(completeGuides)
40+
const [filteredTutorials, setFilteredTutorials] = useState(completeTutorials)
4141
const { siteConfig } = useDocusaurusContext()
4242
const { baseUrl } = siteConfig
4343

4444
// Apply tag filters first
4545
useEffect(() => {
46-
let filtered = completeGuides
46+
let filtered = completeTutorials
4747

4848
if (productFilter.length > 0 || platformFilter.length > 0) {
49-
filtered = completeGuides.filter(item => {
49+
filtered = completeTutorials.filter(item => {
5050
if (!item || !item.tags || !Array.isArray(item.tags)) return false
5151

5252
const prodFil =
@@ -58,8 +58,8 @@ export default function Guides({ content = {} }: GuidesInterface) {
5858
})
5959
}
6060

61-
setFilteredGuides(filtered)
62-
}, [productFilter, platformFilter, completeGuides])
61+
setFilteredTutorials(filtered)
62+
}, [productFilter, platformFilter, completeTutorials])
6363

6464
const onChangeProduct = (selectedOptions: OptionType[]) => {
6565
const filterValue = selectedOptions ? selectedOptions.map(item => item.value) : []
@@ -120,8 +120,8 @@ export default function Guides({ content = {} }: GuidesInterface) {
120120
setSearchInput(input)
121121
}
122122

123-
// Filter the already filtered guides based on search
124-
const displayedGuides = filteredGuides.filter(item => {
123+
// Filter the already filtered tutorials based on search
124+
const displayedTutorials = filteredTutorials.filter(item => {
125125
if (!item) return false // Skip null items
126126
if (!searchInput.trim()) return true
127127

@@ -136,15 +136,15 @@ export default function Guides({ content = {} }: GuidesInterface) {
136136
)
137137
})
138138

139-
// No transformation needed - we'll render GuideCard directly
139+
// No transformation needed - we'll render TutorialCard directly
140140

141141
return (
142142
<Layout title="Tutorials">
143143
<SEO
144144
title="Tutorials"
145145
description="Tutorials to integrate, customize, and build with MetaMask developer tools."
146146
image={`${baseUrl}img/tutorialsog.jpg`}
147-
slug="/guides"
147+
slug="/tutorials"
148148
/>
149149

150150
<Hero
@@ -180,10 +180,10 @@ export default function Guides({ content = {} }: GuidesInterface) {
180180
</div>
181181
</div>
182182

183-
{displayedGuides.length > 0 ? (
183+
{displayedTutorials.length > 0 ? (
184184
<div className={styles.cardsGrid}>
185-
{displayedGuides.map((item: any) => (
186-
<GuideCard
185+
{displayedTutorials.map((item: any) => (
186+
<TutorialCard
187187
key={item.link}
188188
title={item.title}
189189
description={item.description || ''}

0 commit comments

Comments
 (0)