From 08e2f843483009c1e67cf939c4f26a748decb634 Mon Sep 17 00:00:00 2001 From: wildlifehexagon Date: Wed, 29 May 2019 12:29:49 -0500 Subject: [PATCH 1/5] feat: replace dictyNews with twitter feed BREAKING CHANGE: this changes the design of the front page fix #91 --- package-lock.json | 16 ++++ package.json | 1 + src/components/frontpage/News.js | 91 ------------------- src/components/frontpage/Tweets.js | 24 +++++ src/components/pages/EditablePages/AddPage.js | 22 ++++- src/components/pages/Front.js | 5 +- src/components/pages/News/NewsArchive.js | 72 --------------- src/data/learndicty.js | 22 ----- src/data/news.js | 50 ---------- src/routes/Routes.js | 3 - src/styles/NewsContainer.js | 24 ----- src/styles/NewsStyles.js | 21 ----- src/styles/index.js | 1 - 13 files changed, 60 insertions(+), 292 deletions(-) delete mode 100644 src/components/frontpage/News.js create mode 100644 src/components/frontpage/Tweets.js delete mode 100644 src/components/pages/News/NewsArchive.js delete mode 100644 src/data/learndicty.js delete mode 100644 src/data/news.js delete mode 100644 src/styles/NewsContainer.js delete mode 100644 src/styles/NewsStyles.js diff --git a/package-lock.json b/package-lock.json index 0935ae660..c4b444c21 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18335,6 +18335,17 @@ "react-lifecycles-compat": "^3.0.4" } }, + "react-twitter-widgets": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/react-twitter-widgets/-/react-twitter-widgets-1.7.1.tgz", + "integrity": "sha512-bAcR/NKqRbVRJav981bHrm2+xka7NA2nQJB6Urtj9BARqP7aeGHPC0CrrC7wdYIaluOqiF8MiTtURqIJjFs2ZA==", + "requires": { + "exenv": "^1.2.1", + "lodash": "^4.17.4", + "prop-types": "^15.3.0", + "scriptjs": "^2.5.8" + } + }, "reactcss": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/reactcss/-/reactcss-1.2.3.tgz", @@ -19136,6 +19147,11 @@ "ajv-keywords": "^3.1.0" } }, + "scriptjs": { + "version": "2.5.9", + "resolved": "https://registry.npmjs.org/scriptjs/-/scriptjs-2.5.9.tgz", + "integrity": "sha512-qGVDoreyYiP1pkQnbnFAUIS5AjenNwwQBdl7zeos9etl+hYKWahjRTfzAZZYBv5xNHx7vNKCmaLDQZ6Fr2AEXg==" + }, "seamless-immutable": { "version": "7.1.4", "resolved": "https://registry.npmjs.org/seamless-immutable/-/seamless-immutable-7.1.4.tgz", diff --git a/package.json b/package.json index 734e0f6d7..19bc10518 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "react-responsive-carousel": "^3.1.41", "react-router-dom": "^5.0.0", "react-scripts": "^3.0.0", + "react-twitter-widgets": "^1.7.1", "redux": "^4.0.1", "redux-devtools-extension": "^2.13.5", "redux-thunk": "^2.3.0", diff --git a/src/components/frontpage/News.js b/src/components/frontpage/News.js deleted file mode 100644 index e7e51445f..000000000 --- a/src/components/frontpage/News.js +++ /dev/null @@ -1,91 +0,0 @@ -// @flow -import React from "react" -import Grid from "@material-ui/core/Grid" -import { withStyles } from "@material-ui/core/styles" -import FontAwesome from "react-fontawesome" -import twitterLogo from "images/twitterLogo.png" - -import { - NewsContainer, - Header, - ListBox, - Link, - MoreLink, - NewsStockTitle, - Img, - RouterLink, - ListItems, - LeadText, - MainContent, -} from "styles" - -const styles = theme => ({ - twitter: { - paddingLeft: "2px", - paddingRight: "2px", - }, - title: { - paddingLeft: "2px", - }, -}) - -type Props = { - /** The posts to display */ - posts: Object, - /** Material-UI styling */ - classes: Object, -} - -/** Widget that displays the most recent Dicty news */ - -const News = (props: Props) => { - const { posts, classes } = props - - const text = posts.map(post => ( - - - {post.date} - - {post.content} - - )) - - return ( - -
- - - - Twitter logo - - - -
- - DICTY NEWS -
-
-
-
- - - {text} - - - - - - {" "} - more news{" "} - - - - -
- ) -} - -export default withStyles(styles)(News) diff --git a/src/components/frontpage/Tweets.js b/src/components/frontpage/Tweets.js new file mode 100644 index 000000000..64a117016 --- /dev/null +++ b/src/components/frontpage/Tweets.js @@ -0,0 +1,24 @@ +// @flow +import React from "react" +import Grid from "@material-ui/core/Grid" +import { Timeline } from "react-twitter-widgets" + +/** Widget that displays the most recent Dicty news */ + +const Tweets = () => ( + + + + + +) + +export default Tweets diff --git a/src/components/pages/EditablePages/AddPage.js b/src/components/pages/EditablePages/AddPage.js index 6154069f7..e879171c4 100644 --- a/src/components/pages/EditablePages/AddPage.js +++ b/src/components/pages/EditablePages/AddPage.js @@ -2,11 +2,20 @@ import React from "react" import { withRouter } from "react-router-dom" import Grid from "@material-ui/core/Grid" - +import { withStyles } from "@material-ui/core/styles" import PageEditor from "components/editor/PageEditor" import Authorization from "components/authentication/Authorization" import ErrorNotification from "components/authentication/ErrorNotification" -import { Banner } from "styles/NewsStyles" + +const styles = theme => ({ + banner: { + minHeight: "45px", + textAlign: "center", + padding: "40px 20px 20px 20px", + backgroundColor: "#eee", + marginBottom: "20px", + }, +}) const error = "Your login token is expired. Please log out and then log back in to regain full user access." @@ -25,6 +34,8 @@ type Props = { }, /** React-Router object */ match: Object, + /** Material-UI styling */ + classes: Object, } /** @@ -37,6 +48,7 @@ const AddPage = (props: Props) => { state: { name, subname, url }, }, match, + classes, } = props let slug @@ -56,10 +68,10 @@ const AddPage = (props: Props) => { {canEditPages && ( - +

Add Editable Page for Route:

{url}

- +

@@ -81,4 +93,4 @@ const AddPage = (props: Props) => { ) } -export default withRouter(AddPage) +export default withRouter(withStyles(styles)(AddPage)) diff --git a/src/components/pages/Front.js b/src/components/pages/Front.js index ce41ffd6d..d7cee6d2a 100644 --- a/src/components/pages/Front.js +++ b/src/components/pages/Front.js @@ -4,13 +4,12 @@ import { Helmet } from "react-helmet" import Grid from "@material-ui/core/Grid" import { withStyles } from "@material-ui/core/styles" import Slideshow from "components/frontpage/Slideshow" -import News from "components/frontpage/News" +import Tweets from "components/frontpage/Tweets" import Papers from "components/frontpage/Papers" import Popular from "components/frontpage/Popular" import Annotations from "components/frontpage/Annotations" import StockCenter from "components/frontpage/StockCenter" import papers from "data/papers" -import news from "data/news" import annotations from "data/annotations" import stockcenter from "data/stockcenter" @@ -53,7 +52,7 @@ const Front = (props: Props) => { - + diff --git a/src/components/pages/News/NewsArchive.js b/src/components/pages/News/NewsArchive.js deleted file mode 100644 index 50e265f03..000000000 --- a/src/components/pages/News/NewsArchive.js +++ /dev/null @@ -1,72 +0,0 @@ -// @flow -import React from "react" -import Grid from "@material-ui/core/Grid" -import { withStyles } from "@material-ui/core" -import { Helmet } from "react-helmet" -import FontAwesome from "react-fontawesome" -import { Banner, Header, Hdrtxt } from "styles/EditablePageStyles" -import { Link, Img } from "styles" -import news from "data/news" -import twitterLogo from "images/twitterLogo.png" - -const styles = theme => ({ - item: { - paddingBottom: "10px", - }, -}) - -type Props = { - /** Material-UI styling */ - classes: Object, -} - -/** - * This displays the Dicty news archive. - */ - -const NewsArchive = (props: Props) => { - const { classes } = props - - const newsList = news.map(post => ( - - -
- {post.date} -
-
{post.content}
-
- {post.source} -
-
-
- )) - - return ( -
- - dictyBase News Archive - - - -
- Dicty News -
- - Also available at{" "} - - Twitter logo - - -
-
- - {newsList} - -
- ) -} - -export default withStyles(styles)(NewsArchive) diff --git a/src/data/learndicty.js b/src/data/learndicty.js deleted file mode 100644 index 1415b8d84..000000000 --- a/src/data/learndicty.js +++ /dev/null @@ -1,22 +0,0 @@ -export default [ - { - title: "About Dicty", - href: "#About", - }, - { - title: "Research Community", - href: "#Community", - }, - { - title: "Research Focus", - href: "#Focus", - }, - { - title: "Dicty as Educational Tool", - href: "#Education", - }, - { - title: "Available Techniques", - href: "#Techniques", - }, -] diff --git a/src/data/news.js b/src/data/news.js deleted file mode 100644 index d1ddaed3b..000000000 --- a/src/data/news.js +++ /dev/null @@ -1,50 +0,0 @@ -module.exports = [ - { - date: "2018.07.21", - source: "ScienceNews", - content: - "Dicty in the News: Bacteria carried as food within Dictyostelium discoideum are protected by a lectin coat. Reported in ScienceNews, and recently published by Dinh and colleagues in Science with comments by co-author Adam Kuspa.", - }, - { - date: "2018.07.19", - source: "dictyBase", - content: - "Dicty2018: A list of currently registered people is available here. Please check if all your information has been correctly processed and email the organizers if corrections are needed. ", - }, - { - date: "2018.05.14", - source: "Dicty Stock Center", - content: - "Thierry Soldati is amongst 62 life scientists elected to EMBO (European Molecular Biology Organisation) this year. New EMBO members. Congratulations Thierry!", - }, - { - date: "2018.04.24", - source: "Dicty Stock Center", - content: - "Thomas Williams, who graduated and now is a post-doc in Rob Kay's lab, recently first authored a paper in JCS. In addition, JCS chose him to be First Person, a series of interviews with selected first authors, helping early-career researchers promote themselves alongside their papers.", - }, - { - date: "2018.02.13", - source: "dictyBase", - content: - "After Northwestern moved our servers from one campus to the other recently our Blast from the Front - and all Gene Pages, as well as the Genome Browser (including snapshot on gene page) are down. We and Northwestern IT staff are working on the problem. Meanwhile for Blast use the Genome Server, the Blast server which is available from the other genome sites we house. Thanks for your patience! ", - }, - { - date: "2018.02.07", - source: "Medical Express", - content: - "Dicty in the News: New evidence using Dictyostelium discoideum suggests a role for curcumin and related compounds in the treatment of cancer and Alzheimer's disease. Reported in Medical Xpress with comments from Professor Robin SB Williams.", - }, - { - date: "2018.01.29", - source: "dictyBase", - content: - "We are happy to announce that Eric Hartline has joined the dictyBase team. Eric is working with us on user interface and software development.", - }, - { - date: "2018.01.23", - source: "LiveScience", - content: - "Dicty in the News: New research shows that plague bacterium Yersinia pestis can survive and replicate within Dictyostelium discoideum, potentially explaining how the plague can remain dormant for years before unexpectedly re-emerging. Reported in LiveScience and EurekAlert. Recently published by Markman and colleagues in Emerging Infect. Dis.", - }, -] diff --git a/src/routes/Routes.js b/src/routes/Routes.js index 0bed9eb5b..0c249c761 100644 --- a/src/routes/Routes.js +++ b/src/routes/Routes.js @@ -7,7 +7,6 @@ import About from "components/pages/About/About" import InfoPage from "components/pages/EditablePages/InfoPage" import EditInfoPage from "components/pages/EditablePages/EditInfoPage" import AddPage from "components/pages/EditablePages/AddPage" -import NewsArchive from "components/pages/News/NewsArchive" import PapersArchive from "components/pages/Papers/PapersArchive" import Login from "components/authentication/Login" import OauthCallback from "components/authentication/OauthCallback" @@ -24,8 +23,6 @@ const Routes = () => ( - {/* News page routes */} - {/* Authentication routes */} diff --git a/src/styles/NewsContainer.js b/src/styles/NewsContainer.js deleted file mode 100644 index 7b37b0055..000000000 --- a/src/styles/NewsContainer.js +++ /dev/null @@ -1,24 +0,0 @@ -import React from "react" -import styled from "styled-components" - -const NewsContainerStyle = styled.div` - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - line-height: 1.428; - text-align: left; - background-color: #f2f2f2; - border-radius: 15px; - margin-top: 10px; - margin-bottom: 10px; - height: 440px; - overflow: auto; - - @media (max-width: 768px) { - height: 350px; - } -` - -const NewsContainer = ({ children, ...props }) => ( - {children} -) - -export default NewsContainer diff --git a/src/styles/NewsStyles.js b/src/styles/NewsStyles.js deleted file mode 100644 index 9e7f8c20d..000000000 --- a/src/styles/NewsStyles.js +++ /dev/null @@ -1,21 +0,0 @@ -import styled from "styled-components" - -export const Banner = styled.div` - min-height: 60px; - text-align: center; - padding: 48px 30px 30px 30px; - background-color: #eee; - margin-bottom: 30px; -` - -export const Header = styled.h1` - @media (min-width: 768px) { - font-size: 63px; - padding: 2px; - margin: 2px; - } -` - -export const Hdrtxt = styled.p` - font-size: 21px; -` diff --git a/src/styles/index.js b/src/styles/index.js index 58363fd96..41a12edf4 100644 --- a/src/styles/index.js +++ b/src/styles/index.js @@ -1,4 +1,3 @@ -export { default as NewsContainer } from "./NewsContainer" export { default as PaperContainer } from "./PaperContainer" export { default as AnnotationContainer } from "./AnnotationContainer" export { default as StockContainer } from "./StockContainer" From 6445cada18d478fad1ccbe0c6cabedb295b5b396 Mon Sep 17 00:00:00 2001 From: wildlifehexagon Date: Wed, 29 May 2019 12:52:17 -0500 Subject: [PATCH 2/5] feat: update latest papers also remove paper archive link --- src/components/frontpage/Papers.js | 7 +++-- src/data/papers.js | 48 ++++++++++++++---------------- 2 files changed, 26 insertions(+), 29 deletions(-) diff --git a/src/components/frontpage/Papers.js b/src/components/frontpage/Papers.js index 6b7fe26e3..69260a85d 100644 --- a/src/components/frontpage/Papers.js +++ b/src/components/frontpage/Papers.js @@ -15,7 +15,7 @@ import { SourceTitle, Link, MoreLink, - RouterLink, + // RouterLink, } from "styles" /** Widget that displays the latest Dicty papers */ @@ -38,6 +38,7 @@ const Papers = (props: { {paper.title} +
Journal: {paper.journal} @@ -61,11 +62,11 @@ const Papers = (props: { {text} - + {/* {" "} more papers{" "} - + */} ) diff --git a/src/data/papers.js b/src/data/papers.js index 3092913e3..036517c6b 100644 --- a/src/data/papers.js +++ b/src/data/papers.js @@ -1,42 +1,38 @@ module.exports = [ { - author: "Usaj, Zattelman, Regev, Shneyer, Wiesel-Motiuk & Henn", + author: "Tanaka, Jahan, Kondo, Nakano & Yumura (2019)", title: - "Overexpression and purification of human myosins from transiently and stably transfected suspension adapted HEK293SF-3F6 cells.", - journal: - "Anal Biochem. 2018 Jul 31. pii: S0003-2697(18)30419-6. doi: 10.1016/j.ab.2018.07.026. [Epub ahead of print]", - link: "https://www.ncbi.nlm.nih.gov/pubmed/30075102", + "Cytokinesis D is Mediated by Cortical Flow of Dividing Cells Instead of Chemotaxis.", + journal: "Cells 8", + link: "https://www.ncbi.nlm.nih.gov/pubmed/31108912", }, { - author: "Marinović M, Xiong H, Rivero F, Weber I.", + author: + "Odell, Sikirzhytski, Tikhonenko, Cobani, Khodjakov & Koonce (2019)", title: - "Assaying Rho GTPase-Dependent Processes in Dictyostelium discoideum.", - journal: - "Methods Mol Biol. 2018;1821:371-392. doi: 10.1007/978-1-4939-8612-5_25.", - link: "https://www.ncbi.nlm.nih.gov/pubmed/30062425", + "Force balances between interphase centrosomes, as revealed by laser ablation.", + journal: "Mol. Biol. Cell mbcE19010034", + link: "https://www.ncbi.nlm.nih.gov/pubmed/31067156", }, { - author: "Tunnacliffe E, Corrigan AM, Chubb JR.", + author: + "Chen, Luck, Rabe, Dinh, Shaulsky, Nelson, Gershenzon, Dickschat, Kollner & Chen (2019)", title: - "Promoter-mediated diversification of transcriptional bursting dynamics following gene duplication.", - journal: - "Proc Natl Acad Sci U S A. 2018 Jul 30. pii: 201800943. doi: 10.1073/pnas.1800943115. [Epub ahead of print]", - link: "https://www.ncbi.nlm.nih.gov/pubmed/30061408", + "A terpene synthase-cytochrome P450 cluster in Dictyostelium discoideum produces a novel trisnorsesquiterpene.", + journal: "Elife 8", + link: "https://www.ncbi.nlm.nih.gov/pubmed/31063135", }, { - author: - "Song L, Rijal R, Karow M, Stumpf M, Hahn O, Park L, Insall R, Schröder R, Hofmann A, Clemen CS, Eichinger L.", + author: "Yamada & Schaap (2019)", title: - "Expression of N471D strumpellin leads to defects in the endolysosomal system.", - journal: - "Dis Model Mech. 2018 Jul 30. pii: dmm.033449. doi: 10.1242/dmm.033449. [Epub ahead of print]", - link: "https://www.ncbi.nlm.nih.gov/pubmed/30061306", + "Cyclic AMP induction of Dictyostelium prespore gene expression requires autophagy.", + journal: "Dev. Biol.", + link: "https://www.ncbi.nlm.nih.gov/pubmed/31051160", }, { - author: "Tu Y, Rappel WJ.", - title: "Adaptation of Living Systems.", - journal: - "Annu Rev Condens Matter Phys. 2018 Mar;9:183-205. doi: 10.1146/annurev-conmatphys-033117-054046. Epub 2017 Dec 8.", - link: "https://www.ncbi.nlm.nih.gov/pubmed/30057689", + author: "Saga, Iwade, Araki, Ishikawa & Kawata (2019)", + title: "Analysis of DrkA kinase's role in STATa activation.", + journal: "Genes Cells", + link: "https://www.ncbi.nlm.nih.gov/pubmed/31002205", }, ] From 6905691b0a02f1f47aa2302b0e57400f205d4cff Mon Sep 17 00:00:00 2001 From: wildlifehexagon Date: Wed, 29 May 2019 13:59:13 -0500 Subject: [PATCH 3/5] fix: lower width of homepage on xl resolutions fix #123 --- src/components/frontpage/Tweets.js | 2 +- src/components/pages/Front.js | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/frontpage/Tweets.js b/src/components/frontpage/Tweets.js index 64a117016..4d2c30534 100644 --- a/src/components/frontpage/Tweets.js +++ b/src/components/frontpage/Tweets.js @@ -3,7 +3,7 @@ import React from "react" import Grid from "@material-ui/core/Grid" import { Timeline } from "react-twitter-widgets" -/** Widget that displays the most recent Dicty news */ +/** Widget that displays the most recent dictybase tweets */ const Tweets = () => ( diff --git a/src/components/pages/Front.js b/src/components/pages/Front.js index d7cee6d2a..1b4194fad 100644 --- a/src/components/pages/Front.js +++ b/src/components/pages/Front.js @@ -17,6 +17,10 @@ const styles = theme => ({ container: { paddingLeft: "30px", paddingRight: "30px", + [theme.breakpoints.up("xl")]: { + paddingLeft: 0, + paddingRight: 0, + }, }, topItem: { padding: "8px 16px 8px 16px", @@ -47,14 +51,14 @@ const Front = (props: Props) => { content="dictyBase is a central resource for Dictyostelid genomics" /> - - + + - + - + From 1b047e7ac407169f8f88d03bf58fd9dfbb8c1cad Mon Sep 17 00:00:00 2001 From: wildlifehexagon Date: Wed, 29 May 2019 14:14:10 -0500 Subject: [PATCH 4/5] refactor: clean up flow issues --- .../npm/react-twitter-widgets_vx.x.x.js | 172 ++++++++++++++++++ src/components/editor/plugins/fontcolor.js | 10 +- src/components/editor/plugins/fontfamily.js | 4 +- src/components/editor/plugins/fontsize.js | 4 +- src/components/editor/plugins/table.js | 7 +- .../editor/toolbar/EditorToolbar.js | 13 +- 6 files changed, 201 insertions(+), 9 deletions(-) create mode 100644 flow-typed/npm/react-twitter-widgets_vx.x.x.js diff --git a/flow-typed/npm/react-twitter-widgets_vx.x.x.js b/flow-typed/npm/react-twitter-widgets_vx.x.x.js new file mode 100644 index 000000000..5fe89cd35 --- /dev/null +++ b/flow-typed/npm/react-twitter-widgets_vx.x.x.js @@ -0,0 +1,172 @@ +// flow-typed signature: 95ae8495b2c287bd9550d2ec383d38f6 +// flow-typed version: <>/react-twitter-widgets_vx.x.x/flow_v0.80.0 + +/** + * This is an autogenerated libdef stub for: + * + * 'react-twitter-widgets' + * + * Fill this stub out by replacing all the `any` types. + * + * Once filled out, we encourage you to share your work with the + * community by sending a pull request to: + * https://github.com/flowtype/flow-typed + */ + +declare module 'react-twitter-widgets' { + declare module.exports: any; +} + +/** + * We include stubs for each file inside this npm package in case you need to + * require those files directly. Feel free to delete any files that aren't + * needed. + */ +declare module 'react-twitter-widgets/dist/components/AbstractWidget' { + declare module.exports: any; +} + +declare module 'react-twitter-widgets/dist/components/Follow' { + declare module.exports: any; +} + +declare module 'react-twitter-widgets/dist/components/Hashtag' { + declare module.exports: any; +} + +declare module 'react-twitter-widgets/dist/components/Mention' { + declare module.exports: any; +} + +declare module 'react-twitter-widgets/dist/components/Share' { + declare module.exports: any; +} + +declare module 'react-twitter-widgets/dist/components/Timeline' { + declare module.exports: any; +} + +declare module 'react-twitter-widgets/dist/components/Tweet' { + declare module.exports: any; +} + +declare module 'react-twitter-widgets/dist/index' { + declare module.exports: any; +} + +declare module 'react-twitter-widgets/site/src/App' { + declare module.exports: any; +} + +declare module 'react-twitter-widgets/site/src/App.test' { + declare module.exports: any; +} + +declare module 'react-twitter-widgets/site/src/index' { + declare module.exports: any; +} + +declare module 'react-twitter-widgets/site/src/WidgetExample' { + declare module.exports: any; +} + +declare module 'react-twitter-widgets/site/src/widgetPropExamples' { + declare module.exports: any; +} + +declare module 'react-twitter-widgets/src/components/AbstractWidget' { + declare module.exports: any; +} + +declare module 'react-twitter-widgets/src/components/Follow' { + declare module.exports: any; +} + +declare module 'react-twitter-widgets/src/components/Hashtag' { + declare module.exports: any; +} + +declare module 'react-twitter-widgets/src/components/Mention' { + declare module.exports: any; +} + +declare module 'react-twitter-widgets/src/components/Share' { + declare module.exports: any; +} + +declare module 'react-twitter-widgets/src/components/Timeline' { + declare module.exports: any; +} + +declare module 'react-twitter-widgets/src/components/Tweet' { + declare module.exports: any; +} + +declare module 'react-twitter-widgets/src/index' { + declare module.exports: any; +} + +// Filename aliases +declare module 'react-twitter-widgets/dist/components/AbstractWidget.js' { + declare module.exports: $Exports<'react-twitter-widgets/dist/components/AbstractWidget'>; +} +declare module 'react-twitter-widgets/dist/components/Follow.js' { + declare module.exports: $Exports<'react-twitter-widgets/dist/components/Follow'>; +} +declare module 'react-twitter-widgets/dist/components/Hashtag.js' { + declare module.exports: $Exports<'react-twitter-widgets/dist/components/Hashtag'>; +} +declare module 'react-twitter-widgets/dist/components/Mention.js' { + declare module.exports: $Exports<'react-twitter-widgets/dist/components/Mention'>; +} +declare module 'react-twitter-widgets/dist/components/Share.js' { + declare module.exports: $Exports<'react-twitter-widgets/dist/components/Share'>; +} +declare module 'react-twitter-widgets/dist/components/Timeline.js' { + declare module.exports: $Exports<'react-twitter-widgets/dist/components/Timeline'>; +} +declare module 'react-twitter-widgets/dist/components/Tweet.js' { + declare module.exports: $Exports<'react-twitter-widgets/dist/components/Tweet'>; +} +declare module 'react-twitter-widgets/dist/index.js' { + declare module.exports: $Exports<'react-twitter-widgets/dist/index'>; +} +declare module 'react-twitter-widgets/site/src/App.js' { + declare module.exports: $Exports<'react-twitter-widgets/site/src/App'>; +} +declare module 'react-twitter-widgets/site/src/App.test.js' { + declare module.exports: $Exports<'react-twitter-widgets/site/src/App.test'>; +} +declare module 'react-twitter-widgets/site/src/index.js' { + declare module.exports: $Exports<'react-twitter-widgets/site/src/index'>; +} +declare module 'react-twitter-widgets/site/src/WidgetExample.js' { + declare module.exports: $Exports<'react-twitter-widgets/site/src/WidgetExample'>; +} +declare module 'react-twitter-widgets/site/src/widgetPropExamples.js' { + declare module.exports: $Exports<'react-twitter-widgets/site/src/widgetPropExamples'>; +} +declare module 'react-twitter-widgets/src/components/AbstractWidget.js' { + declare module.exports: $Exports<'react-twitter-widgets/src/components/AbstractWidget'>; +} +declare module 'react-twitter-widgets/src/components/Follow.js' { + declare module.exports: $Exports<'react-twitter-widgets/src/components/Follow'>; +} +declare module 'react-twitter-widgets/src/components/Hashtag.js' { + declare module.exports: $Exports<'react-twitter-widgets/src/components/Hashtag'>; +} +declare module 'react-twitter-widgets/src/components/Mention.js' { + declare module.exports: $Exports<'react-twitter-widgets/src/components/Mention'>; +} +declare module 'react-twitter-widgets/src/components/Share.js' { + declare module.exports: $Exports<'react-twitter-widgets/src/components/Share'>; +} +declare module 'react-twitter-widgets/src/components/Timeline.js' { + declare module.exports: $Exports<'react-twitter-widgets/src/components/Timeline'>; +} +declare module 'react-twitter-widgets/src/components/Tweet.js' { + declare module.exports: $Exports<'react-twitter-widgets/src/components/Tweet'>; +} +declare module 'react-twitter-widgets/src/index.js' { + declare module.exports: $Exports<'react-twitter-widgets/src/index'>; +} diff --git a/src/components/editor/plugins/fontcolor.js b/src/components/editor/plugins/fontcolor.js index bfdf01b2b..67cb1125e 100644 --- a/src/components/editor/plugins/fontcolor.js +++ b/src/components/editor/plugins/fontcolor.js @@ -6,6 +6,11 @@ import FormatColorTextIcon from "@material-ui/icons/FormatColorText" import ToolbarButton from "../toolbar/ToolbarButton" import { ButtonProps, NodeProps } from "../flow/types" +type colorProps = { + showColorPicker: boolean, + setShowColorPicker: Function, +} + /** * Functions to set the font color marks. */ @@ -48,7 +53,10 @@ const FontColorMark = ({ children, mark: { data } }: NodeProps) => ( /** * Button component that uses a click handler to connect to the ColorPicker component. */ -const FontColorButton = ({ showColorPicker, setShowColorPicker }) => ( +const FontColorButton = ({ + showColorPicker, + setShowColorPicker, +}: colorProps) => ( { diff --git a/src/components/editor/plugins/fontfamily.js b/src/components/editor/plugins/fontfamily.js index 7c70990e3..221ca9f2d 100644 --- a/src/components/editor/plugins/fontfamily.js +++ b/src/components/editor/plugins/fontfamily.js @@ -3,7 +3,7 @@ import React, { useState } from "react" import MenuItem from "@material-ui/core/MenuItem" import FormControl from "@material-ui/core/FormControl" import Select from "@material-ui/core/Select" -import { NodeProps } from "../flow/types" +import { NodeProps, ButtonProps } from "../flow/types" /** * List of fonts available @@ -65,7 +65,7 @@ const FontFamilyMark = ({ children, mark: { data } }: NodeProps) => ( /** * Dropdown component that connects to the editor. */ -const FontFamilyDropdown = ({ editor, classes }) => { +const FontFamilyDropdown = ({ editor, classes }: ButtonProps) => { const [currentFont, setCurrentFont] = useState(3) return ( diff --git a/src/components/editor/plugins/fontsize.js b/src/components/editor/plugins/fontsize.js index 16aac370a..98eae361e 100644 --- a/src/components/editor/plugins/fontsize.js +++ b/src/components/editor/plugins/fontsize.js @@ -3,7 +3,7 @@ import React, { useState } from "react" import MenuItem from "@material-ui/core/MenuItem" import FormControl from "@material-ui/core/FormControl" import Select from "@material-ui/core/Select" -import { NodeProps } from "../flow/types" +import { NodeProps, ButtonProps } from "../flow/types" /** * List of font sizes @@ -68,7 +68,7 @@ const FontSizeMark = ({ children, mark: { data } }: NodeProps) => ( /** * Button components that use click handlers to connect to the editor. */ -const FontSizeDropdown = ({ editor, classes }) => { +const FontSizeDropdown = ({ editor, classes }: ButtonProps) => { const [currentFontSize, setCurrentFontSize] = useState(2) return ( diff --git a/src/components/editor/plugins/table.js b/src/components/editor/plugins/table.js index b33a59a66..64213f27a 100644 --- a/src/components/editor/plugins/table.js +++ b/src/components/editor/plugins/table.js @@ -9,6 +9,11 @@ import DeleteIcon from "@material-ui/icons/Delete" import ToolbarButton from "../toolbar/ToolbarButton" import { ButtonProps, NodeProps } from "../flow/types" +type tableProps = { + showTableOptions: boolean, + setShowTableOptions: Function, +} + /** * Rendering components that provide the actual HTML to use inside the editor. */ @@ -30,7 +35,7 @@ const TableCellNode = ({ attributes, children }: NodeProps) => ( const InsertInitialTableButton = ({ showTableOptions, setShowTableOptions, -}) => ( +}: tableProps) => ( { diff --git a/src/components/editor/toolbar/EditorToolbar.js b/src/components/editor/toolbar/EditorToolbar.js index 3f0196f98..5f2720c0c 100644 --- a/src/components/editor/toolbar/EditorToolbar.js +++ b/src/components/editor/toolbar/EditorToolbar.js @@ -101,15 +101,22 @@ const styles = theme => ({ }, }) +type Props = { + /** Material-UI styling */ + classes: Object, + /** Function for saving page content */ + onSave: Function, +} + /** * The toolbar for the page editor. It uses Material-UI's AppBar component as the foundation, then displays individual buttons inside of it. */ -export const EditorToolbar = props => { +export const EditorToolbar = (props: Props) => { const [showColorPicker, setShowColorPicker] = useState(false) const [showTableOptions, setShowTableOptions] = useState(false) const [showHelpModal, setShowHelpModal] = useState(false) - const { classes, ...other } = props + const { classes, onSave, ...other } = props return ( <> @@ -208,7 +215,7 @@ export const EditorToolbar = props => { size="small" variant="contained" color="primary" - onClick={props.onSave}> + onClick={onSave}> Save From 3e474143bc2703d468c5a3b1a9cb644d249c4640 Mon Sep 17 00:00:00 2001 From: wildlifehexagon Date: Wed, 29 May 2019 14:17:02 -0500 Subject: [PATCH 5/5] test: add tests for Tweets component --- src/components/frontpage/Tweets.test.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/components/frontpage/Tweets.test.js diff --git a/src/components/frontpage/Tweets.test.js b/src/components/frontpage/Tweets.test.js new file mode 100644 index 000000000..67ebfc9ed --- /dev/null +++ b/src/components/frontpage/Tweets.test.js @@ -0,0 +1,18 @@ +import React from "react" +import { shallow } from "enzyme" +import Tweets from "./Tweets" +import Grid from "@material-ui/core/Grid" +import { Timeline } from "react-twitter-widgets" + +describe("frontpage/Tweets", () => { + const wrapper = shallow() + describe("initial render", () => { + it("renders without crashing", () => { + expect(wrapper).toHaveLength(1) + }) + it("always renders initial components", () => { + expect(wrapper.find(Grid)).toHaveLength(2) + expect(wrapper.find(Timeline)).toHaveLength(1) + }) + }) +})