mirror of
https://github.com/uetchy/namae.git
synced 2025-08-20 09:58:13 +09:00
chore: emit source maps
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
import React, {useState, useEffect, Suspense} from 'react';
|
||||
import styled from 'styled-components';
|
||||
import useFetch from 'fetch-suspense';
|
||||
import Tooltip from 'rc-tooltip';
|
||||
import React, { Suspense, useEffect, useState } from 'react';
|
||||
import { OutboundLink } from 'react-ga';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { GoInfo } from 'react-icons/go';
|
||||
import { IoIosFlash } from 'react-icons/io';
|
||||
import BarLoader from 'react-spinners/BarLoader';
|
||||
import {GoInfo} from 'react-icons/go';
|
||||
import {IoIosFlash} from 'react-icons/io';
|
||||
import {useTranslation} from 'react-i18next';
|
||||
import {OutboundLink} from 'react-ga';
|
||||
|
||||
import {sendError, sendExpandEvent} from '../../util/analytics';
|
||||
import {mobile} from '../../util/css';
|
||||
import {useStoreActions} from '../../store';
|
||||
import styled from 'styled-components';
|
||||
import { useStoreActions } from '../../store';
|
||||
import { sendError, sendExpandEvent } from '../../util/analytics';
|
||||
import { mobile } from '../../util/css';
|
||||
|
||||
export const COLORS = {
|
||||
available: '#6e00ff',
|
||||
@@ -18,7 +17,7 @@ export const COLORS = {
|
||||
error: '#ff388b',
|
||||
};
|
||||
|
||||
export const Card: React.FC<{title: string}> = ({title, children}) => {
|
||||
export const Card: React.FC<{ title: string }> = ({ title, children }) => {
|
||||
return (
|
||||
<CardContainer>
|
||||
<CardTitle>{title}</CardTitle>
|
||||
@@ -33,9 +32,9 @@ export const Repeater: React.FC<{
|
||||
items: string[];
|
||||
moreItems?: string[];
|
||||
children: (name: string) => React.ReactNode;
|
||||
}> = ({items = [], moreItems = [], children}) => {
|
||||
}> = ({ items = [], moreItems = [], children }) => {
|
||||
const [revealAlternatives, setRevealAlternatives] = useState(false);
|
||||
const {t} = useTranslation();
|
||||
const { t } = useTranslation();
|
||||
|
||||
function onClick() {
|
||||
sendExpandEvent();
|
||||
@@ -154,7 +153,7 @@ export const ExistentialAvailability: React.FC<{
|
||||
icon,
|
||||
}) => {
|
||||
const increaseCounter = useStoreActions((actions) => actions.stats.add);
|
||||
const response = useFetch(target, undefined, {metadata: true});
|
||||
const response = useFetch(target, undefined, { metadata: true });
|
||||
|
||||
if (response.status !== 404 && response.status !== 200) {
|
||||
throw new NotFoundError(`${name}: ${response.status}`);
|
||||
@@ -220,8 +219,7 @@ export const Result: React.FC<{
|
||||
<OutboundLink
|
||||
to={link}
|
||||
eventLabel={link.split('/')[2]}
|
||||
target="_blank"
|
||||
>
|
||||
target="_blank">
|
||||
{content}
|
||||
</OutboundLink>
|
||||
) : (
|
||||
@@ -245,16 +243,16 @@ export const Result: React.FC<{
|
||||
// 4. render(), now with eventId provided from Sentry
|
||||
class ErrorBoundary extends React.Component<
|
||||
{},
|
||||
{hasError: boolean; message: string; eventId?: string}
|
||||
{ hasError: boolean; message: string; eventId?: string }
|
||||
> {
|
||||
constructor(props: {}) {
|
||||
super(props);
|
||||
this.state = {hasError: false, message: '', eventId: undefined};
|
||||
this.state = { hasError: false, message: '', eventId: undefined };
|
||||
}
|
||||
|
||||
// used in SSR
|
||||
static getDerivedStateFromError(error: Error) {
|
||||
return {hasError: true, message: error.message};
|
||||
return { hasError: true, message: error.message };
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
@@ -263,7 +261,7 @@ class ErrorBoundary extends React.Component<
|
||||
return;
|
||||
}
|
||||
sendError(error, errorInfo).then((eventId) => {
|
||||
this.setState({eventId});
|
||||
this.setState({ eventId });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -276,8 +274,7 @@ class ErrorBoundary extends React.Component<
|
||||
this.state.eventId ? ` (${this.state.eventId})` : ''
|
||||
}`}
|
||||
placement="top"
|
||||
trigger={['hover']}
|
||||
>
|
||||
trigger={['hover']}>
|
||||
<ResultItem color={COLORS.error}>
|
||||
<ResultIcon>
|
||||
<GoInfo />
|
||||
@@ -292,15 +289,14 @@ class ErrorBoundary extends React.Component<
|
||||
}
|
||||
}
|
||||
|
||||
const ErrorHandler: React.FC = ({children}) => (
|
||||
const ErrorHandler: React.FC = ({ children }) => (
|
||||
<ErrorBoundary>
|
||||
<Suspense
|
||||
fallback={
|
||||
<ResultContainer>
|
||||
<BarLoader />
|
||||
</ResultContainer>
|
||||
}
|
||||
>
|
||||
}>
|
||||
{children}
|
||||
</Suspense>
|
||||
</ErrorBoundary>
|
||||
@@ -368,7 +364,7 @@ export const ResultItem = styled.div`
|
||||
flex-direction: row;
|
||||
align-items: flex-start;
|
||||
word-break: break-all;
|
||||
color: ${({color}) => color};
|
||||
color: ${({ color }) => color};
|
||||
`;
|
||||
|
||||
export const ResultName = styled.div`
|
||||
|
@@ -1,35 +1,34 @@
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import styled from 'styled-components';
|
||||
import {useTranslation} from 'react-i18next';
|
||||
import {mobile} from '../../util/css';
|
||||
|
||||
import { mobile } from '../../util/css';
|
||||
import AppStoreCard from './providers/AppStore';
|
||||
import CratesioCard from './providers/Cratesio';
|
||||
import DomainCard from './providers/Domains';
|
||||
import FirebaseCard from './providers/Firebase';
|
||||
import GithubCard from './providers/GitHubRepository';
|
||||
import GithubSearchCard from './providers/GitHubSearch';
|
||||
import GitLabCard from './providers/GitLab';
|
||||
import HerokuCard from './providers/Heroku';
|
||||
import HomebrewCard from './providers/Homebrew';
|
||||
import InstagramCard from './providers/Instagram';
|
||||
import JsOrgCard from './providers/JsOrg';
|
||||
import LinuxCard from './providers/Linux';
|
||||
import NetlifyCard from './providers/Netlify';
|
||||
import NpmCard from './providers/Npm';
|
||||
import NtaCard from './providers/Nta';
|
||||
import OcamlCard from './providers/Ocaml';
|
||||
import PypiCard from './providers/PyPI';
|
||||
import RubyGemsCard from './providers/RubyGems';
|
||||
import CratesioCard from './providers/Cratesio';
|
||||
import HomebrewCard from './providers/Homebrew';
|
||||
import LinuxCard from './providers/Linux';
|
||||
import TwitterCard from './providers/Twitter';
|
||||
import InstagramCard from './providers/Instagram';
|
||||
import SpectrumCard from './providers/Spectrum';
|
||||
import SlackCard from './providers/Slack';
|
||||
import S3Card from './providers/S3';
|
||||
import JsOrgCard from './providers/JsOrg';
|
||||
import GithubSearchCard from './providers/GitHubSearch';
|
||||
import AppStoreCard from './providers/AppStore';
|
||||
import HerokuCard from './providers/Heroku';
|
||||
import SlackCard from './providers/Slack';
|
||||
import SpectrumCard from './providers/Spectrum';
|
||||
import TwitterCard from './providers/Twitter';
|
||||
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 Index: React.FC<{ query: string }> = ({ query }) => {
|
||||
const {
|
||||
i18n: {language},
|
||||
i18n: { language },
|
||||
} = useTranslation();
|
||||
|
||||
return (
|
||||
|
@@ -1,17 +1,16 @@
|
||||
import React from 'react';
|
||||
import useFetch from 'fetch-suspense';
|
||||
import {useTranslation} from 'react-i18next';
|
||||
import {FaAppStore, FaInfoCircle} from 'react-icons/fa';
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { FaAppStore, FaInfoCircle } from 'react-icons/fa';
|
||||
import { Card, Result } from '../core';
|
||||
|
||||
import {Card, Result} from '../core';
|
||||
|
||||
const Search: React.FC<{query: string}> = ({query}) => {
|
||||
const {t} = useTranslation();
|
||||
const Search: React.FC<{ query: string }> = ({ query }) => {
|
||||
const { t } = useTranslation();
|
||||
const term = encodeURIComponent(query);
|
||||
const response = useFetch(
|
||||
`/availability/appstore/${term}?country=${t('countryCode')}`,
|
||||
) as {
|
||||
result: Array<{name: string; viewURL: string; price: number; id: string}>;
|
||||
result: Array<{ name: string; viewURL: string; price: number; id: string }>;
|
||||
};
|
||||
const apps = response.result;
|
||||
|
||||
@@ -34,8 +33,8 @@ const Search: React.FC<{query: string}> = ({query}) => {
|
||||
);
|
||||
};
|
||||
|
||||
const AppStoreCard: React.FC<{query: string}> = ({query}) => {
|
||||
const {t} = useTranslation();
|
||||
const AppStoreCard: React.FC<{ query: string }> = ({ query }) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<Card title={t('providers.appStore')}>
|
||||
|
Reference in New Issue
Block a user