Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
Add /chat link (#66)
Browse files Browse the repository at this point in the history
* Update discord links to use "/chat"
* Update SmartLink component to allow local links to appear in new tabs
  • Loading branch information
julieg18 authored May 24, 2022
1 parent 4ae4947 commit 7ada899
Show file tree
Hide file tree
Showing 10 changed files with 156 additions and 105 deletions.
192 changes: 99 additions & 93 deletions gatsby-config.js
Original file line number Diff line number Diff line change
@@ -1,98 +1,104 @@
const path = require('path')
module.exports = {
siteMetadata: {
title: 'MLEM - Machine Learning Engineering Management',
description: 'Open-source tool to simplify ML model deployment',
siteUrl: process.env.HEROKU_APP_NAME
? `https://${process.env.HEROKU_APP_NAME}.herokuapp.com`
: 'https://mlem.ai',
twitterUsername: '@DVCorg',
titleTemplate: '%s | MLEM',
keywords: ['mlem']

const siteMetadata = {
title: 'MLEM - Machine Learning Engineering Management',
description: 'Open-source tool to simplify ML model deployment',
siteUrl: process.env.HEROKU_APP_NAME
? `https://${process.env.HEROKU_APP_NAME}.herokuapp.com`
: 'https://mlem.ai',
twitterUsername: '@DVCorg',
titleTemplate: '%s | MLEM',
keywords: ['mlem']
}

const plugins = [
'gatsby-plugin-eslint',
{
resolve: '@dvcorg/gatsby-theme-iterative',
options: {
cssBase: path.join(
'src',
'@dvcorg',
'gatsby-theme-iterative',
'components',
'Page',
'base.css'
),
customMediaConfig: {
importFrom: './src/styles/media.css'
}
}
},
plugins: [
'gatsby-plugin-eslint',
{
resolve: '@dvcorg/gatsby-theme-iterative',
options: {
cssBase: path.join(
'src',
'@dvcorg',
'gatsby-theme-iterative',
'components',
'Page',
'base.css'
),
customMediaConfig: {
importFrom: './src/styles/media.css'
{
resolve: 'gatsby-plugin-manifest',
options: {
name: 'MLEM',
short_name: 'MLEM',
icon: 'src/images/icon-512x512.png',
start_url: '/',
background_color: '#F5F7F8',
theme_color: '#F5F7F8',
display: 'standalone',
icons: [
{
src: '/apple-touch-icon-48x48.png',
sizes: '48x48',
type: 'image/png'
},
{
src: '/apple-touch-icon-72x72.png',
sizes: '72x72',
type: 'image/png'
},
{
src: '/apple-touch-icon-96x96.png',
sizes: '96x96',
type: 'image/png'
},
{
src: '/apple-touch-icon-144x144.png',
sizes: '144x144',
type: 'image/png'
},
{
src: '/apple-touch-icon.png',
sizes: '180x180',
type: 'image/png'
},
{
src: '/apple-touch-icon-192x192.png',
sizes: '192x192',
type: 'image/png'
},
{
src: '/apple-touch-icon-256x256.png',
sizes: '256x256',
type: 'image/png'
},
{
src: '/apple-touch-icon-384x384.png',
sizes: '384x384',
type: 'image/png'
},
{
src: '/apple-touch-icon-512x512.png',
sizes: '512x512',
type: 'image/png'
}
}
},
{
resolve: 'gatsby-plugin-manifest',
options: {
name: 'MLEM',
short_name: 'MLEM',
icon: 'src/images/icon-512x512.png',
start_url: '/',
background_color: '#F5F7F8',
theme_color: '#F5F7F8',
display: 'standalone',
icons: [
{
src: '/apple-touch-icon-48x48.png',
sizes: '48x48',
type: 'image/png'
},
{
src: '/apple-touch-icon-72x72.png',
sizes: '72x72',
type: 'image/png'
},
{
src: '/apple-touch-icon-96x96.png',
sizes: '96x96',
type: 'image/png'
},
{
src: '/apple-touch-icon-144x144.png',
sizes: '144x144',
type: 'image/png'
},
{
src: '/apple-touch-icon.png',
sizes: '180x180',
type: 'image/png'
},
{
src: '/apple-touch-icon-192x192.png',
sizes: '192x192',
type: 'image/png'
},
{
src: '/apple-touch-icon-256x256.png',
sizes: '256x256',
type: 'image/png'
},
{
src: '/apple-touch-icon-384x384.png',
sizes: '384x384',
type: 'image/png'
},
{
src: '/apple-touch-icon-512x512.png',
sizes: '512x512',
type: 'image/png'
}
]
}
},
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'images',
path: `${__dirname}/src/images`
}
]
}
},
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'images',
path: `${__dirname}/src/images`
}
]
},
'gatsby-plugin-meta-redirect'
]

module.exports = {
plugins,
siteMetadata
}
9 changes: 9 additions & 0 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,12 @@ exports.sourceNodes = ({ actions, createNodeId, createContentDigest }) => {
createNode(node)
})
}

exports.createPages = ({ actions }) => {
const { createRedirect } = actions
createRedirect({
fromPath: '/chat',
toPath: 'https://discord.gg/vupEEYd7zh',
isPermanent: true
})
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"gatsby": "^4.14.1",
"gatsby-plugin-image": "^2.1.0",
"gatsby-plugin-manifest": "^4.1.0",
"gatsby-plugin-meta-redirect": "^1.1.1",
"gatsby-plugin-postcss": "^5.1.0",
"gatsby-plugin-react-helmet": "^5.1.0",
"gatsby-plugin-remove-serviceworker": "^1.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ const RightPanel: React.FC<IRightPanelProps> = ({

<Link
className={cn(sharedStyles.button, styles.button)}
href="https://dvc.org/chat"
href="/chat"
target="_blank"
>
<i className={cn(sharedStyles.buttonIcon, styles.discordIcon)} />
Expand Down
10 changes: 8 additions & 2 deletions src/components/Footer/FooterList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface IFooterListProps {
text: string
icon?: 'github' | 'discord' | 'twitter' | 'linkedin' | 'youtube'
href: string
target?: '_blank'
}>
}

Expand Down Expand Up @@ -50,8 +51,13 @@ const FooterList: React.FC<IFooterListProps> = ({
{title}
</h2>
<div className={styles.list__links}>
{links.map(({ text, href, icon }, i) => (
<SmartLink className={styles.list__link} key={i} href={href}>
{links.map(({ text, href, icon, target }, i) => (
<SmartLink
target={target}
className={styles.list__link}
key={i}
href={href}
>
{icon && icons[icon]}
{text}
</SmartLink>
Expand Down
5 changes: 3 additions & 2 deletions src/components/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ const footerListData: Array<IFooterListProps> = [
},
{ href: 'https://github.com/iterative', text: 'Github', icon: 'github' },
{
href: 'https://dvc.org/chat',
href: '/chat',
text: 'Discord',
icon: 'discord'
icon: 'discord',
target: '_blank'
}
]
}
Expand Down
10 changes: 8 additions & 2 deletions src/components/NavBar/SocialIcon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface ISocialIconProps {
href: string
label: string
className?: string
target?: '_blank'
}

const icons = {
Expand All @@ -27,10 +28,15 @@ const SocialIcon: React.FC<ISocialIconProps> = ({
className,
icon,
href,
label
label,
target
}) => {
return (
<SmartLink className={cn(className, styles.socialIcon)} href={href}>
<SmartLink
target={target}
className={cn(className, styles.socialIcon)}
href={href}
>
{icons[icon]}
<span className="sr-only">{label}</span>
</SmartLink>
Expand Down
14 changes: 10 additions & 4 deletions src/components/NavBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ const socialLinks: Array<ISocialIconProps> = [
},
{
icon: 'discord',
href: 'https://dvc.org/chat',
label: 'Go to DVC Discord'
href: '/chat',
label: 'Go to DVC Discord',
target: '_blank'
}
]

Expand Down Expand Up @@ -54,9 +55,14 @@ const NavBar: React.FC = () => {
Coming Soon
</Button>
<ul className={styles.nav__icons}>
{socialLinks.map(({ icon, href, label }, i) => (
{socialLinks.map(({ icon, href, label, target }, i) => (
<li key={i}>
<SocialIcon icon={icon} href={href} label={label} />
<SocialIcon
target={target}
icon={icon}
href={href}
label={label}
/>
</li>
))}
</ul>
Expand Down
2 changes: 1 addition & 1 deletion src/components/SmartLink/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const SmartLink: React.FC<PropsWithChildren<ISmartLinkProps>> = ({
return <span className={className}>{children}</span>
}

if (isExternal) {
if (isExternal || target === '_blank') {
return (
<a
className={className}
Expand Down
16 changes: 16 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6908,6 +6908,15 @@ fs-extra@^10.1.0:
jsonfile "^6.0.1"
universalify "^2.0.0"

fs-extra@^7.0.0:
version "7.0.1"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9"
integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==
dependencies:
graceful-fs "^4.1.2"
jsonfile "^4.0.0"
universalify "^0.1.0"

fs-extra@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0"
Expand Down Expand Up @@ -7138,6 +7147,13 @@ gatsby-plugin-manifest@^4.1.0, gatsby-plugin-manifest@^4.14.0:
semver "^7.3.7"
sharp "^0.30.3"

gatsby-plugin-meta-redirect@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/gatsby-plugin-meta-redirect/-/gatsby-plugin-meta-redirect-1.1.1.tgz#058e8e53edff38dc44d3bb6153109d01c910f863"
integrity sha512-Oc4qgU3SlDUM9qoxIMKO+re2bdMs3/a2KXrfL65gb8XMLsHylBbveWtXZRhgjd2QDL/49RX4S9SEykuadRju2w==
dependencies:
fs-extra "^7.0.0"

gatsby-plugin-page-creator@^4.14.1:
version "4.14.1"
resolved "https://registry.yarnpkg.com/gatsby-plugin-page-creator/-/gatsby-plugin-page-creator-4.14.1.tgz#117872c22657438875ec76cafee93c69a4a5805c"
Expand Down

0 comments on commit 7ada899

Please sign in to comment.