forked from iterative/dvc.org
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial commit for community page * Add styles to community page blocks * Addicons to meet blocks * Remove console.log * Add styles to Discord block * Add styles for events * Add illustration to community blocks * Add real github api for issues * Add comment about Github API mock * Move @octokit/graphql to dependencies * Add blog api integration * Real API to get latest blog posts * Update texts * Add pluralization to comments count * Add comments to blog posts * Cache test * Rewrote comments API using fetch * Only show console.log in cache in dev mode * Add cache to github * Replace Discord with widget * Hide events block if there is no upcoming events * Add simple fallback for api handles * Mobile version design * Add dropdown menu to contribute * Mobile design tweaks * Fix comments height * Revert discord widget * Get discord stats from static file * Return deleted images * Revert "Mobile design tweaks" This reverts commit d10481f. # Conflicts: # src/Community/Block/styles.js # src/Community/styles.js * Mobile styles for section in community * Small design changes * Fix lint-staged bug * Add carousel to community page * Fix lint error * Add images to blog posts * Add mobile banner * Make all mobile section parts clickable * Fix forum posts display on desktop * Remove focus state from carousel dots * Temporarily disable carousel * Add small visual fixes * Fix mobile safari bug * Update desktop dropdown styles * Remove carousel * Add pictures to user content * Add quick and dirty fix for section animation * Added some user content * three pieces of user content * added the prague event, cleaned up events city + date formatting * Added WIDS event * WIDS logo * Added divops.org * Fixed divops date, and checked if the banners work as expected * typo * Added readable date support * Change rel for external links to correct one * Update Cotribute section actions * Fix menu title * Replace icons * Fix non-even columns * Add json linters * Add paddings for sections on tablets * Fix lint errors * Update banner for Feb 20 * Added image icons to user content * increase banner resolution * Fix links and add analytics to community page * Remove Learn section icons * Normalize event pictures * Add placeholder for events images * Fix image line wrap * Fix preemptive sendind of errors * Add ref forwarding to button * Update top menu styles (no-triangle) * Update movile menu * Add github and discord icons to header * Fix opacity for links * Make community headers clickable * Fix Collapsible calculation on resize * Open section on mobile navigation * Reduce size of the icons in the head * Fix bug woth bottom pading on tablet in Communuty * Add triangle to dropdown menu * Add subjects to mail links * Revert issues sorting order * Open mail links in the new window * Set correct icon to mail in mobile menu * Fix not working links in top menu * update hero banners * Fix item collapse in mobile safari * Fix couple of visual bugs * Refactor Community page in line with other pages * Change blog api error status to 502 * Rename BareButton to CommunityButton * Remove mistakenly copied images * Remove getInitialProps to reenable static optimizations Co-authored-by: Elle O'Brien <[email protected]> Co-authored-by: Nate Gadzhibalaev <[email protected]> Co-authored-by: Ivan Shcheklein <[email protected]>
- Loading branch information
1 parent
2b4e36d
commit c32e687
Showing
74 changed files
with
2,609 additions
and
361 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,17 @@ | ||
{ | ||
"addons": [ | ||
|
||
], | ||
"addons": [], | ||
"buildpacks": [ | ||
{ | ||
"url": "heroku/nodejs" | ||
} | ||
], | ||
"env": { | ||
}, | ||
"env": {}, | ||
"formation": { | ||
"web": { | ||
"quantity": 1 | ||
} | ||
}, | ||
"name": "dvc.org", | ||
"scripts": { | ||
}, | ||
"scripts": {}, | ||
"stack": "heroku-18" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import fetch from 'isomorphic-fetch' | ||
|
||
export default async (_, res) => { | ||
try { | ||
const response = await fetch(`https://blog.dvc.org/api/posts.json`) | ||
|
||
if (response.status !== 200) { | ||
res.status(502).json({ error: 'Unexpected response from Blog' }) | ||
|
||
return | ||
} | ||
|
||
const data = await response.text() | ||
|
||
res.status(200).json(data) | ||
} catch { | ||
res.status(502) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* eslint-env node */ | ||
|
||
import fetch from 'isomorphic-fetch' | ||
import NodeCache from 'node-cache' | ||
|
||
import { FORUM_URL } from '../../src/consts' | ||
|
||
const cache = new NodeCache({ stdTTL: 900 }) | ||
|
||
const dev = process.env.NODE_ENV === 'development' | ||
|
||
export default async (_, res) => { | ||
if (cache.get('topics')) { | ||
if (dev) console.log('Using cache for "topics"') | ||
|
||
res.status(200).json(cache.get('topics')) | ||
|
||
return | ||
} else { | ||
if (dev) console.log('Not using cache for "topics"') | ||
} | ||
|
||
try { | ||
const response = await fetch(`${FORUM_URL}/latest.json?order=created`) | ||
|
||
if (response.status !== 200) { | ||
res.status(502).json({ error: 'Unexpected response from Forum' }) | ||
|
||
return | ||
} | ||
|
||
const data = await response.text() | ||
|
||
const { | ||
topic_list: { topics: original_topics } | ||
} = JSON.parse(data) | ||
|
||
const topics = original_topics.slice(0, 3).map(item => ({ | ||
title: item.title, | ||
comments: item.posts_count - 1, | ||
date: item.last_posted_at, | ||
url: `${FORUM_URL}/t/${item.slug}/${item.id}` | ||
})) | ||
|
||
cache.set('topics', { topics }) | ||
|
||
res.status(200).json({ topics }) | ||
} catch { | ||
res.status(404) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* eslint-env node */ | ||
|
||
import { graphql } from '@octokit/graphql' | ||
import NodeCache from 'node-cache' | ||
|
||
const cache = new NodeCache({ stdTTL: 900 }) | ||
|
||
const dev = process.env.NODE_ENV === 'development' | ||
|
||
export default async (_, res) => { | ||
if (!process.env.GITHUB_TOKEN) { | ||
res.status(200).json({ issues: [] }) | ||
} else { | ||
if (cache.get('issues')) { | ||
if (dev) console.log('Using cache for "issues"') | ||
|
||
res.status(200).json({ issues: cache.get('issues') }) | ||
} else { | ||
console.log('Not using cache for "issues"') | ||
} | ||
|
||
try { | ||
const { repository } = await graphql( | ||
` | ||
{ | ||
repository(owner: "iterative", name: "dvc") { | ||
issues( | ||
first: 3 | ||
states: OPEN | ||
orderBy: { field: CREATED_AT, direction: DESC } | ||
) { | ||
edges { | ||
node { | ||
title | ||
createdAt | ||
url | ||
comments { | ||
totalCount | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
`, | ||
{ | ||
headers: { | ||
authorization: `token ${process.env.GITHUB_TOKEN}` | ||
} | ||
} | ||
) | ||
|
||
const issues = repository.issues.edges.map(({ node }) => ({ | ||
title: node.title, | ||
url: node.url, | ||
comments: node.comments.totalCount, | ||
date: node.createdAt | ||
})) | ||
|
||
cache.set('issues', issues) | ||
|
||
res.status(200).json({ issues }) | ||
} catch (e) { | ||
res.status(404) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React from 'react' | ||
import Head from 'next/head' | ||
|
||
import { | ||
getLatestIssues, | ||
getLatestTopics, | ||
getLatestPosts | ||
} from '../src/utils/api' | ||
|
||
import Community from '../src/components/Community' | ||
|
||
import { META_BASE_TITLE } from '../src/consts' | ||
|
||
export default function CommunityPage(props) { | ||
return ( | ||
<> | ||
<Head> | ||
<link | ||
rel="stylesheet" | ||
type="text/css" | ||
charSet="UTF-8" | ||
href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.min.css" | ||
/> | ||
<link | ||
rel="stylesheet" | ||
type="text/css" | ||
href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick-theme.min.css" | ||
/> | ||
<title>Community | {META_BASE_TITLE}</title> | ||
</Head> | ||
<Community {...props} /> | ||
</> | ||
) | ||
} | ||
|
||
CommunityPage.getInitialProps = async ({ req }) => { | ||
const issues = await getLatestIssues(req) | ||
const posts = await getLatestPosts(req) | ||
const topics = await getLatestTopics(req) | ||
|
||
return { | ||
issues, | ||
posts, | ||
topics | ||
} | ||
} |
Oops, something went wrong.