From ed0424b5d17367fe303b4b90cd921b01c9606681 Mon Sep 17 00:00:00 2001 From: Yasuaki Uechi Date: Thu, 18 Jun 2020 20:32:27 +0900 Subject: [PATCH] feat: add firebase --- .nowignore | 4 +++ api/{services => tests}/existense.test.ts | 2 +- web/public/locales/en/translation.json | 3 +- web/public/locales/ja/translation.json | 3 +- web/src/components/Welcome.tsx | 5 ++- web/src/components/cards/index.tsx | 2 ++ .../components/cards/providers/Firebase.tsx | 35 +++++++++++++++++++ web/src/util/i18n.ts | 2 +- yarn.lock | 16 ++++----- 9 files changed, 59 insertions(+), 13 deletions(-) rename api/{services => tests}/existense.test.ts (99%) create mode 100644 web/src/components/cards/providers/Firebase.tsx diff --git a/.nowignore b/.nowignore index dcf734a..4ef1964 100644 --- a/.nowignore +++ b/.nowignore @@ -1,3 +1,7 @@ /web/build +/web/coverage +/api/coverage /.envrc /.env +/.github +/.vscode diff --git a/api/services/existense.test.ts b/api/tests/existense.test.ts similarity index 99% rename from api/services/existense.test.ts rename to api/tests/existense.test.ts index fc2a396..bac66f8 100644 --- a/api/services/existense.test.ts +++ b/api/tests/existense.test.ts @@ -1,7 +1,7 @@ import nock from 'nock'; import {mockProvider} from '../util/testHelpers'; -import provider from './existence'; +import provider from '../services/existence'; test('return false if name is taken', async () => { const result = await mockProvider(provider, {query: 'github.com/uetchy'}); diff --git a/web/public/locales/en/translation.json b/web/public/locales/en/translation.json index c225808..11c510e 100644 --- a/web/public/locales/en/translation.json +++ b/web/public/locales/en/translation.json @@ -25,7 +25,8 @@ "now": "Vercel", "netlify": "Netlify", "nta": "Company (JP)", - "ocaml": "OCaml" + "ocaml": "OCaml", + "firebase": "Firebase" }, "uniqueness": { "high": "Pretty unique", diff --git a/web/public/locales/ja/translation.json b/web/public/locales/ja/translation.json index 44ec8b3..b778d9b 100644 --- a/web/public/locales/ja/translation.json +++ b/web/public/locales/ja/translation.json @@ -25,7 +25,8 @@ "now": "Vercel", "netlify": "Netlify", "nta": "法人", - "ocaml": "OCaml" + "ocaml": "OCaml", + "firebase": "Firebase" }, "uniqueness": { "high": "とてもユニーク", diff --git a/web/src/components/Welcome.tsx b/web/src/components/Welcome.tsx index b40059b..3fe40df 100644 --- a/web/src/components/Welcome.tsx +++ b/web/src/components/Welcome.tsx @@ -20,7 +20,7 @@ import { FaBuilding, } from 'react-icons/fa'; import {IoIosBeer} from 'react-icons/io'; -import {DiRust, DiHeroku} from 'react-icons/di'; +import {DiRust, DiHeroku, DiFirebase} from 'react-icons/di'; import {SpectrumIcon, NowIcon, NetlifyIcon, OcamlIcon} from './Icons'; import {mobile} from '../util/css'; @@ -99,6 +99,9 @@ const Welcome: React.FC = () => { {t('providers.s3')} + + {t('providers.firebase')} + {t('providers.jsorg')} diff --git a/web/src/components/cards/index.tsx b/web/src/components/cards/index.tsx index 2430570..abf53ed 100644 --- a/web/src/components/cards/index.tsx +++ b/web/src/components/cards/index.tsx @@ -25,6 +25,7 @@ import VercelCard from './providers/Vercel'; import NtaCard from './providers/Nta'; import NetlifyCard from './providers/Netlify'; import OcamlCard from './providers/Ocaml'; +import FirebaseCard from './providers/Firebase'; const Index: React.FC<{query: string}> = ({query}) => { const { @@ -53,6 +54,7 @@ const Index: React.FC<{query: string}> = ({query}) => { + diff --git a/web/src/components/cards/providers/Firebase.tsx b/web/src/components/cards/providers/Firebase.tsx new file mode 100644 index 0000000..fec078c --- /dev/null +++ b/web/src/components/cards/providers/Firebase.tsx @@ -0,0 +1,35 @@ +import React from 'react'; +import {useTranslation} from 'react-i18next'; +import {DiFirebase} from 'react-icons/di'; + +import {Card, Repeater, DedicatedAvailability} from '../core'; + +const FirebaseCard: React.FC<{query: string}> = ({query}) => { + const {t} = useTranslation(); + + const sanitizedQuery = query + .replace(/[^0-9a-zA-Z_-]/g, '') + .replace(/_/g, '-'); + const lowerCase = sanitizedQuery.toLowerCase(); + + const names = [lowerCase]; + + return ( + + + {(name) => ( + } + /> + )} + + + ); +}; + +export default FirebaseCard; diff --git a/web/src/util/i18n.ts b/web/src/util/i18n.ts index c76379f..cbf687f 100644 --- a/web/src/util/i18n.ts +++ b/web/src/util/i18n.ts @@ -5,7 +5,7 @@ import XHR from 'i18next-xhr-backend'; import LanguageDetector from 'i18next-browser-languagedetector'; import {initReactI18next} from 'react-i18next'; -const TRANSLATION_VERSION = '1.15'; +const TRANSLATION_VERSION = '1.16'; i18n .use(Backend) diff --git a/yarn.lock b/yarn.lock index 335d695..824b030 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1895,10 +1895,10 @@ jest-diff "^25.2.1" pretty-format "^25.2.1" -"@types/jest@^25.2.3": - version "25.2.3" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-25.2.3.tgz#33d27e4c4716caae4eced355097a47ad363fdcaf" - integrity sha512-JXc1nK/tXHiDhV55dvfzqtmP4S3sy3T3ouV2tkViZgxY/zeUkcpQcQPGRlgF4KmWzWW5oiWYSZwtCB+2RsE4Fw== +"@types/jest@^26.0.0": + version "26.0.0" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.0.tgz#a6d7573dffa9c68cbbdf38f2e0de26f159e11134" + integrity sha512-/yeMsH9HQ1RLORlXAwoLXe8S98xxvhNtUz3yrgrwbaxYjT+6SFPZZRksmRKRA6L5vsUtSHeN71viDOTTyYAD+g== dependencies: jest-diff "^25.2.1" pretty-format "^25.2.1" @@ -10730,10 +10730,10 @@ react-helmet@^6.0.0: react-fast-compare "^2.0.4" react-side-effect "^2.1.0" -react-i18next@11.5.0: - version "11.5.0" - resolved "https://registry.yarnpkg.com/react-i18next/-/react-i18next-11.5.0.tgz#84a9bb535d44c0c1b336b94de164515c2cc2a714" - integrity sha512-V6rUT7MzYBdFCgUrhfr78FHRfnY3CFoR75ET9EP5Py5UPHKyaGiK1MvPx03TesLwsmIaVHlRFU/WLzqCedXevA== +react-i18next@11.5.1: + version "11.5.1" + resolved "https://registry.yarnpkg.com/react-i18next/-/react-i18next-11.5.1.tgz#084e98555d8800d5508eccc8da1ac652df358d3e" + integrity sha512-2VSx+dClvmCJTgrw9Nrof4EkggMlzo4s/YZPEUAdI7gU2HTksapkGtFPARzpeTk+3k1zY+Xl6pLHc0LYvsRWAQ== dependencies: "@babel/runtime" "^7.3.1" html-parse-stringify2 "2.0.1"