diff --git a/app/embeds/Dropbox.js b/app/embeds/Dropbox.js index f56d063f2c..ee07a35f8d 100644 --- a/app/embeds/Dropbox.js +++ b/app/embeds/Dropbox.js @@ -1,5 +1,7 @@ // @flow import * as React from "react"; +import styled from "styled-components"; +import env from "env"; const URL_REGEX = new RegExp("^https://www.dropbox.com/s/(.*)$"); @@ -20,25 +22,29 @@ class Dropbox extends React.Component { var tag = document.createElement("script"); tag.async = false; tag.id = "dropboxjs"; - tag.setAttribute("data-app-key", "zuf12mnhan22y62"); + tag.setAttribute("data-app-key", env.DROPBOX_APP_KEY); tag.src = "https://www.dropbox.com/static/api/2/dropins.js"; document.body?.appendChild(tag); } render() { return ( -
+ - Dropbox Embed - -
+ /> + ); } } +const Rounded = styled.div` + border-radius: 3px; +`; + export default Dropbox; diff --git a/app/embeds/index.js b/app/embeds/index.js index c30a0a1bae..2a72e47fe5 100644 --- a/app/embeds/index.js +++ b/app/embeds/index.js @@ -1,4 +1,5 @@ // @flow +import { filter } from "lodash"; import * as React from "react"; import styled from "styled-components"; import Image from "components/Image"; @@ -30,6 +31,7 @@ import Trello from "./Trello"; import Typeform from "./Typeform"; import Vimeo from "./Vimeo"; import YouTube from "./YouTube"; +import env from "env"; function matcher(Component) { return (url: string) => { @@ -49,204 +51,219 @@ const Img = styled(Image)` height: 18px; `; -export default [ - { - title: "Abstract", - keywords: "design", - icon: () => , - component: Abstract, - matcher: matcher(Abstract), - }, - { - title: "Airtable", - keywords: "spreadsheet", - icon: () => , - component: Airtable, - matcher: matcher(Airtable), - }, - { - title: "Cawemo", - keywords: "bpmn process", - defaultHidden: true, - icon: () => , - component: Cawemo, - matcher: matcher(Cawemo), - }, - { - title: "ClickUp", - keywords: "project", - defaultHidden: true, - icon: () => , - component: ClickUp, - matcher: matcher(ClickUp), - }, - { - title: "Codepen", - keywords: "code editor", - icon: () => , - component: Codepen, - matcher: matcher(Codepen), - }, - { - title: "Descript", - keywords: "audio", - icon: () => , - component: Descript, - matcher: matcher(Descript), - }, - { - title: "Dropbox", - keywords: "dropbox file pdf", - icon: () => , - component: Dropbox, - matcher: matcher(Dropbox), - }, - { - title: "Figma", - keywords: "design svg vector", - icon: () => , - component: Figma, - matcher: matcher(Figma), - }, - { - title: "Framer", - keywords: "design prototyping", - icon: () => , - component: Framer, - matcher: matcher(Framer), - }, - { - title: "GitHub Gist", - keywords: "code", - icon: () => , - component: Gist, - matcher: matcher(Gist), - }, - { - title: "Google Drawings", - keywords: "drawings", - icon: () => , - component: GoogleDrawings, - matcher: matcher(GoogleDrawings), - }, - { - title: "Google Drive", - keywords: "drive", - icon: () => , - component: GoogleDrive, - matcher: matcher(GoogleDrive), - }, - { - title: "Google Docs", - icon: () => , - component: GoogleDocs, - matcher: matcher(GoogleDocs), - }, - { - title: "Google Sheets", - keywords: "excel spreadsheet", - icon: () => , - component: GoogleSheets, - matcher: matcher(GoogleSheets), - }, - { - title: "Google Slides", - keywords: "presentation slideshow", - icon: () => , - component: GoogleSlides, - matcher: matcher(GoogleSlides), - }, - { - title: "InVision", - keywords: "design prototype", - defaultHidden: true, - icon: () => , - component: InVision, - matcher: matcher(InVision), - }, - { - title: "Loom", - keywords: "video screencast", - icon: () => , - component: Loom, - matcher: matcher(Loom), - }, - { - title: "Lucidchart", - keywords: "chart", - icon: () => , - component: Lucidchart, - matcher: matcher(Lucidchart), - }, - { - title: "Marvel", - keywords: "design prototype", - icon: () => , - component: Marvel, - matcher: matcher(Marvel), - }, - { - title: "Mindmeister", - keywords: "mindmap", - icon: () => , - component: Mindmeister, - matcher: matcher(Mindmeister), - }, - { - title: "Miro", - keywords: "whiteboard", - icon: () => , - component: Miro, - matcher: matcher(Miro), - }, - { - title: "Mode", - keywords: "analytics", - defaultHidden: true, - icon: () => , - component: ModeAnalytics, - matcher: matcher(ModeAnalytics), - }, - { - title: "Prezi", - keywords: "presentation", - icon: () => , - component: Prezi, - matcher: matcher(Prezi), - }, - { - title: "Spotify", - keywords: "music", - icon: () => , - component: Spotify, - matcher: matcher(Spotify), - }, - { - title: "Trello", - keywords: "kanban", - icon: () => , - component: Trello, - matcher: matcher(Trello), - }, - { - title: "Typeform", - keywords: "form survey", - icon: () => , - component: Typeform, - matcher: matcher(Typeform), - }, - { - title: "Vimeo", - keywords: "video", - icon: () => , - component: Vimeo, - matcher: matcher(Vimeo), - }, - { - title: "YouTube", - keywords: "google video", - icon: () => , - component: YouTube, - matcher: matcher(YouTube), - }, -]; +type EmbedSpec = { + title: string, + keywords?: string, + defaultHidden?: boolean, + icon: any, + component: React.ComponentType, + matcher: any, +}; + +export default filter( + [ + { + title: "Abstract", + keywords: "design", + icon: () => , + component: Abstract, + matcher: matcher(Abstract), + }, + { + title: "Airtable", + keywords: "spreadsheet", + icon: () => , + component: Airtable, + matcher: matcher(Airtable), + }, + { + title: "Cawemo", + keywords: "bpmn process", + defaultHidden: true, + icon: () => , + component: Cawemo, + matcher: matcher(Cawemo), + }, + { + title: "ClickUp", + keywords: "project", + defaultHidden: true, + icon: () => , + component: ClickUp, + matcher: matcher(ClickUp), + }, + { + title: "Codepen", + keywords: "code editor", + icon: () => , + component: Codepen, + matcher: matcher(Codepen), + }, + { + title: "Descript", + keywords: "audio", + defaultHidden: true, + icon: () => , + component: Descript, + matcher: matcher(Descript), + }, + env.DROPBOX_APP_KEY + ? { + title: "Dropbox", + keywords: "dropbox file pdf", + icon: () => , + component: Dropbox, + matcher: matcher(Dropbox), + } + : undefined, + { + title: "Figma", + keywords: "design svg vector", + icon: () => , + component: Figma, + matcher: matcher(Figma), + }, + { + title: "Framer", + keywords: "design prototyping", + icon: () => , + component: Framer, + matcher: matcher(Framer), + }, + { + title: "GitHub Gist", + keywords: "code", + icon: () => , + component: Gist, + matcher: matcher(Gist), + }, + { + title: "Google Drawings", + keywords: "drawings", + icon: () => , + component: GoogleDrawings, + matcher: matcher(GoogleDrawings), + }, + { + title: "Google Drive", + keywords: "drive", + icon: () => , + component: GoogleDrive, + matcher: matcher(GoogleDrive), + }, + { + title: "Google Docs", + icon: () => , + component: GoogleDocs, + matcher: matcher(GoogleDocs), + }, + { + title: "Google Sheets", + keywords: "excel spreadsheet", + icon: () => , + component: GoogleSheets, + matcher: matcher(GoogleSheets), + }, + { + title: "Google Slides", + keywords: "presentation slideshow", + icon: () => , + component: GoogleSlides, + matcher: matcher(GoogleSlides), + }, + { + title: "InVision", + keywords: "design prototype", + defaultHidden: true, + icon: () => , + component: InVision, + matcher: matcher(InVision), + }, + { + title: "Loom", + keywords: "video screencast", + icon: () => , + component: Loom, + matcher: matcher(Loom), + }, + { + title: "Lucidchart", + keywords: "chart", + icon: () => , + component: Lucidchart, + matcher: matcher(Lucidchart), + }, + { + title: "Marvel", + keywords: "design prototype", + icon: () => , + component: Marvel, + matcher: matcher(Marvel), + }, + { + title: "Mindmeister", + keywords: "mindmap", + icon: () => , + component: Mindmeister, + matcher: matcher(Mindmeister), + }, + { + title: "Miro", + keywords: "whiteboard", + icon: () => , + component: Miro, + matcher: matcher(Miro), + }, + { + title: "Mode", + keywords: "analytics", + defaultHidden: true, + icon: () => , + component: ModeAnalytics, + matcher: matcher(ModeAnalytics), + }, + { + title: "Prezi", + keywords: "presentation", + icon: () => , + component: Prezi, + matcher: matcher(Prezi), + }, + { + title: "Spotify", + keywords: "music", + icon: () => , + component: Spotify, + matcher: matcher(Spotify), + }, + { + title: "Trello", + keywords: "kanban", + icon: () => , + component: Trello, + matcher: matcher(Trello), + }, + { + title: "Typeform", + keywords: "form survey", + icon: () => , + component: Typeform, + matcher: matcher(Typeform), + }, + { + title: "Vimeo", + keywords: "video", + icon: () => , + component: Vimeo, + matcher: matcher(Vimeo), + }, + { + title: "YouTube", + keywords: "google video", + icon: () => , + component: YouTube, + matcher: matcher(YouTube), + }, + ], + (i: void | EmbedSpec) => !!i +); diff --git a/public/images/dropbox.png b/public/images/dropbox.png new file mode 100644 index 0000000000..23a0b65786 Binary files /dev/null and b/public/images/dropbox.png differ diff --git a/server/env.js b/server/env.js index 204f6cc94f..144970dc86 100644 --- a/server/env.js +++ b/server/env.js @@ -11,6 +11,7 @@ export default { TEAM_LOGO: process.env.TEAM_LOGO, SLACK_KEY: process.env.SLACK_KEY, SLACK_APP_ID: process.env.SLACK_APP_ID, + DROPBOX_APP_KEY: process.env.DROPBOX_APP_KEY, MAXIMUM_IMPORT_SIZE: process.env.MAXIMUM_IMPORT_SIZE || 1024 * 1000 * 5, SUBDOMAINS_ENABLED: process.env.SUBDOMAINS_ENABLED === "true", GOOGLE_ANALYTICS_ID: process.env.GOOGLE_ANALYTICS_ID,