This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import {Provider} from 'react-redux'; | |
import App, {Container} from 'next/app'; | |
import withRedux from 'next-redux-wrapper'; | |
import {PersistGate} from 'redux-persist/integration/react'; | |
import {Api} from '@shelf/sdk'; | |
import Error from './_error'; | |
import {initStore} from '../lib/store'; | |
import {initRollbar} from '../lib/rollbar'; | |
import {initIntercom} from '../lib/intercom'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Amplify Params - DO NOT EDIT | |
You can access the following resource attributes as environment variables from your Lambda function | |
var environment = process.env.ENV | |
var region = process.env.REGION | |
var storageEmailsBucketName = process.env.STORAGE_EMAILS_BUCKETNAME | |
Amplify Params - DO NOT EDIT */ | |
var storageEmailsBucketName = process.env.STORAGE_EMAILS_BUCKETNAME; | |
var AWS = require('aws-sdk'); | |
var s3 = new AWS.S3(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i18n | |
├── README.md | |
├── babel.config.js | |
├── create-translations.js | |
├── crowdin.yml | |
├── package.json | |
├── renovate.json | |
├── src | |
│ ├── bundles | |
│ │ ├── app-1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const taskId = ''; //TODO: get task if from prev mutaition | |
const raw = JSON.stringify({ | |
filename: 'Screenshot 2021-08-20 at 12.06.13.png', | |
type: 'image/png', | |
}); | |
const {key: uploadKey, uploadId} = await fetch('https://api.gsstaging.net/cpw/uppy/s3/multipart', { | |
method: 'POST', | |
headers: { | |
'x-cpw-task-id': taskId, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Now | |
*/ | |
import Api from './api'; | |
import {ContentApi} from './index'; | |
Api.API_HOST = 'x'; | |
Api.AUTH_TOKEN = 'y'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
files: | |
- source: /src/resources/en/**/*.json | |
translation: /src/resources/%two_letters_code%/**/%original_file_name% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import i18NextLib from 'i18next'; | |
import {initReactI18next} from 'react-i18next'; //To have a react context | |
import {resources} from 'dictionary-package/lib/bundles/app-1'; //reduce bundles if there is many | |
import {defaultInterpolation} from 'dictionary-package/lib/lib/helpers'; // day-to-day functions to format text | |
const i18next = i18NextLib.createInstance(); | |
i18next.use(initReactI18next).init({ | |
lng: 'en', | |
resources, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {useTranslation} from 'react-i18next'; | |
const Index: FC = () => { | |
const {t} = useTranslation(); | |
return ( | |
<MainLayout pageTitle={t(`app-1.common.pageTitle`)}> | |
{t(`app-1.common.pageTitle`)} | |
</MainLayout> | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
//Simple key->translation | |
"search": "Suchen", | |
"noResults": "Keine Suchergebnisse gefunden", | |
"publish": "Veröffentlichen", | |
"cancel": "Abbrechen", | |
"save": "Speichern", | |
//nested key->key->translation | |
"fileTypes": { | |
"document": "Dokument", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function useVisibilityChange(serverFallback: boolean) { | |
const getServerSnapshot = () => serverFallback; | |
const [getSnapshot, subscribe] = useMemo(() => { | |
return [ | |
() => document.visibilityState === 'visible', | |
(notify: () => void) => { | |
window.addEventListener('visibilitychange', notify); | |
return () => { | |
window.removeEventListener('visibilitychange', notify); |