From 33c468d2be43c37044dcefb239dba2d54e67a208 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Tue, 8 Jun 2021 21:47:01 -0700 Subject: [PATCH] fix: Allow Dropbox to only show when APP_KEY is present fix: Add correct icon --- app/embeds/Dropbox.js | 18 +- app/embeds/index.js | 419 ++++++++++++++++++++------------------ public/images/dropbox.png | Bin 0 -> 1973 bytes server/env.js | 1 + 4 files changed, 231 insertions(+), 207 deletions(-) create mode 100644 public/images/dropbox.png 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 0000000000000000000000000000000000000000..23a0b6578630e551b9d5fb0b47abf7ab708bfd2a GIT binary patch literal 1973 zcmV;m2TJ&fP)H8Z=5?@HwNJw%%1!yJ`S1Qt33aDFT|0j_k*N6`>|^XX z-;|^OENV4x`_1@-x&c4fMNRMEaAVKW`_+Hl14!pXKgAWkLbhQOHJyXaYfp*x`C zFdF_1q+#L;z1RK*R4|B|#=)*2Di%pW*nBoXi5B&(vh@WBh;uN%u{QaGFm55+5Q#e6 z!Q1}*Xl%^h<4=y&?3WEt5-n%X={NygfQ>{n$8*~TgA z*AC7XF;aqG&7}(2W<}KJ4we^0#j;!i)Iro0d@5YXHnXBO4we@&(sEe>tWU@`XQJ-L zh;aw?V-(&E=d?FaJ3ZVhCqG^(C4W}mzChg^mBF8f$5%htdw`nh2Y){6kEcC&+i!hYqhl2w}F;b*BPllY=Oy@gWfRe4rFaaV-wu0@xU zLLrPrQ9>+Y;);7rrwjfxNvh!<#-foMi@4*83;d1?Wf|^mtT&Q^u(@miL0CseZo>nO z4JL0aavbA|X9ys+Co8q#hp|EvWNZ{B7WoP(MNJS_#CKJuiax1=s94g(B4nMFlzq`$ zhLg6DlE4>>90wuqyB!cgJJ~>MIJvRpP>Pxcd4y5awG_4S?6d8m!?7j713+j3s@%13f9@gHMUWmnsg3c>SXK$&Hhrce8ieu z)G4Cq8*tAx)w7y0b4>|F&FA2-aS*;~L2mp9^bTXCjy31!s$|9Wbd_=eiza@qiB;6} zwP?C=5c&BrWpg5vsOcQcH4Y*%2;-Y;A{RBqdGOmY6}SODd>Any1gfaltEYyA=`BDtVDeuDr(=ZN=cLO{3(^B36DTg`}RefvYRA0 zN`P{&bnq5+Et3s&L6}q_+jxk2-NCZ26M9Wd5LVtT2PjdmO&9u<-6Y{(0xV6)HV#o= z&IgxzozNWa{iaOtVb{~$z z^+L5fcS3im?z`KoVRE2{H&FABQnO0 zrR~DN?ROlR1;gDWbPk@NGCVejiUkvd(TSSvZW4M2YvK$KNqxA$24Uf%X1?Ws$H5c6 zDHT45O525j=}p!#fDtvePLO2wir2vt?&uSn`sD4xzz1RLnMG_#)q^w+)+`y0F;-Sp zDLkdha1l#72Tx2XRX;Qsxa-GK+ler}$tO`?a|KZ@(mPnAAGfZ@QyFh3!v)IKR)bfqAEIJ?Pwcnxx2#q%^7g zSG@|n6Ix=S!*wtr5wY)@kmq1cNpnNO-w-3y!4v$wUNPi*&7KFc9juW!X;9F+CgeMK zLPknO(#o2WavZG5H$Ef(HG2z`<=}~wL0D<8*}I@j2T$;(ROP;A&!TJxYs_Q&QCac_ zP*KZk_Mip_PtXKmBI?JK