Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import Router from 'next/router';
import Link from 'next/link';
import Generic from '../Generic';
// TODO: the dynamic types are a pain to work with, need to get improved submit PR
const dynamicOpts: DynamicOptions = {
ssr: true,
loading: () => <p>Loading...</p>,
modules: props => ({
CountryProfileLowerTabs: import('../../organisms/CountryProfileLowerTabs') as Promise
}),
render: (props, {CountryProfileLowerTabs}) =>
};
const DynamicCountryProfileLowerTabs = dynamic(dynamicOpts as any);
interface Props {
id: string;
rehydrated?: boolean;
state?: StateToShare;
}
export default class Profile extends React.Component {
public static init(props) {
const country = getCountry(props.id);
const selectedTab = props.state && props.state.chartId &&
props.state.chartId !== GOVERNMENT_FINANCE_LOWER ? 1 : 0;
return {selectedTab, country};
}
public state: {
selectedTab: number,
import RouteCard from './route-card'
import RouteSegments from './route-segments'
import TimeCutoff from './time-cutoff'
const Loader = () => (
<div>
</div>
)
// Certain components depend on config options, so dynamically load them
const ConfigCard = dynamic(() => import('./config-card'))
const Log = dynamic(() => import('./log'))
const GeocodeSearch = dynamic(() => import('./geocode-search'), {ssr: false})
const Info = dynamic(() => import('./info'))
const PoiSearch = dynamic(() => import('./poi-search'))
// Cannot import map on the server
const Map = dynamic(() => import('./map'), {
loading: Loader,
ssr: false
})
// Default access token
const MBAT = process.env.MAPBOX_ACCESS_TOKEN
export default class Application extends Component {
state = {
showInfo: this.props.info && !this.props.user // first visit to the site
}
_geocode = text => {
() => import(/* webpackChunkName: 'yc/2.en' */ 'src/contents/yc/2.en'),
{ loading: () => }
),
jp: dynamic(
// @ts-ignore - import isn't typed correctly
() => import(/* webpackChunkName: 'yc/2.jp' */ 'src/contents/yc/2.jp'),
{ loading: () => }
)
},
'yc/3': {
en: dynamic(
// @ts-ignore - import isn't typed correctly
() => import(/* webpackChunkName: 'yc/3.en' */ 'src/contents/yc/3.en'),
{ loading: () => }
),
jp: dynamic(
// @ts-ignore - import isn't typed correctly
() => import(/* webpackChunkName: 'yc/3.jp' */ 'src/contents/yc/3.jp'),
{ loading: () => }
)
},
'yc/4': {
en: dynamic(
// @ts-ignore - import isn't typed correctly
() => import(/* webpackChunkName: 'yc/4.en' */ 'src/contents/yc/4.en'),
{ loading: () => }
),
jp: dynamic(
// @ts-ignore - import isn't typed correctly
() => import(/* webpackChunkName: 'yc/4.jp' */ 'src/contents/yc/4.jp'),
{ loading: () => }
)
import Avatar from '../../Avatar';
import LoadingPlaceholder from '../../LoadingPlaceholder';
import StyledRoundButton from '../../StyledRoundButton';
import StyledButton from '../../StyledButton';
import Container from '../../Container';
import { EditAvatarMutation } from '../graphql/mutations';
import Link from '../../Link';
const AVATAR_SIZE = 128;
// Dynamically import components for admins
const DropzoneLoadingPlaceholder = () => (
);
const dynamicParams = { loading: DropzoneLoadingPlaceholder, ssr: false };
const Dropzone = dynamic(() => import(/* webpackChunkName: 'react-dropzone' */ 'react-dropzone'), dynamicParams);
const EditOverlay = styled.div`
position: absolute;
width: 128px;
height: 128px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background: rgba(255, 255, 255, 0.75);
cursor: pointer;
text-align: center;
padding: 1em;
border-radius: ${props => props.borderRadius};
`;
import React from 'react'
import dynamic from 'next/dynamic'
import { Provider } from 'mobx-react'
import initRootStore from '@stores/init'
import ThemeWrapper from '@containers/ThemeWrapper'
// import EditorJS from '@editorjs/editorjs'
// eslint-disable-next-line no-unused-vars
const html =
'<div class="cps-viewer"><h2 class="cps-viewer-header">Editor.js</h2><p class="cps-viewer-paragraph">Hey. Meet the new Editor. On this page you can see it in action — try to edit this text.</p><h3 class="cps-viewer-header">Key features</h3><ul><li>It is a block-styled editor</li><li>It returns clean data output in JSON</li><li>Designed to be extendable and pluggable with a simple API</li></ul><h3 class="cps-viewer-header">Key features</h3><ol><li>It is a block-styled editor</li><li>It returns clean data output in JSON</li><li>Designed to be extendable and pluggable with a simple API</li></ol><h3 class="cps-viewer-header">What does it mean «block-styled editor»</h3><div class="cps-viewer-checklist"><div>This is a block-styled editor</div><div>Clean output data</div><div>Simple and powerful API</div></div><p class="cps-viewer-paragraph">Workspace in classic editors is made of a single contenteditable element, used to create different HTML markups. Editor.js <mark class="cdx-marker">workspace consists of separate Blocks: paragraphs, headings, images, lists, quotes, etc</mark>. Each of them is an independent contenteditable element (or more complex structure) provided by Plugin and united by Editor\'s Core.</p><p class="cps-viewer-paragraph">There are dozens of <a href="https://github.com/editor-js">ready-to-use Blocks</a> and the <a href="https://editorjs.io/creating-a-block-tool">simple API</a> for creation any Block you need. For example, you can implement Blocks for Tweets, Instagram posts, surveys and polls, CTA-buttons and even games.</p><h3 class="cps-viewer-header">What does it mean clean data output</h3><p class="cps-viewer-paragraph">Classic WYSIWYG-editors produce raw HTML-markup with both content data and content appearance. On the contrary, Editor.js outputs JSON object with data of each Block. You can see an example below</p><p class="cps-viewer-paragraph">Given data can be used as you want: render with HTML for <code class="inline-code">Web clients</code>, render natively for <code class="inline-code">mobile apps</code>, create markup for <code class="inline-code">Facebook Instant Articles</code> or <code class="inline-code">Google AMP</code>, generate an <code class="inline-code">audio version</code> and so on.</p><p class="cps-viewer-paragraph">Clean data is useful to sanitize, validate and process on the backend.</p><div class="cps-viewer-delimiter"></div><p class="cps-viewer-paragraph">We have been working on this project more than three years. Several large media projects help us to test and debug the Editor, to make it\'s core more stable. At the same time we significantly improved the API. Now, it can be used to create any plugin for any task. Hope you enjoy. 😏</p><div class="cps-viewer-image"><img src="https://codex.so/upload/redactor_images/o_e48549d1855c7fc1807308dd14990126.jpg"></div><div class="cps-viewer-linker"><a href="https://www.github.com">https://www.github.com</a></div><div class="cps-viewer-quote">quote demo text</div><div>'
export const DynamicRichEditor = dynamic({
loader: () => import('@containers/RichEditor'),
ssr: false,
})
const Editor = () => {
const store = initRootStore({ langSetup: {} })
return (
</div></div>
/**
* Drupal pages resolution library.
*/
import dynamic from 'next/dynamic'
import ErrorPage404 from '~client/components/ErrorPage404'
import { routes } from './routes'
const NodeArticle = dynamic(() => import('~client/pages/drupal/node/article'))
const NodePage = dynamic(() => import('~client/pages/drupal/node/page'))
// prettier-ignore
// the pages registry, in order of precendence.
const pages = [
{ component: NodeArticle, is: routes['drupal/node/article'] },
{ component: NodePage, is: routes['drupal/node/page'] },
{ component: ErrorPage404, is: () => true }
]
export default pages
const Loader = () => (
<div>
</div>
)
// Certain components depend on config options, so dynamically load them
const ConfigCard = dynamic(() => import('./config-card'))
const Log = dynamic(() => import('./log'))
const GeocodeSearch = dynamic(() => import('./geocode-search'), {ssr: false})
const Info = dynamic(() => import('./info'))
const PoiSearch = dynamic(() => import('./poi-search'))
// Cannot import map on the server
const Map = dynamic(() => import('./map'), {
loading: Loader,
ssr: false
})
// Default access token
const MBAT = process.env.MAPBOX_ACCESS_TOKEN
export default class Application extends Component {
state = {
showInfo: this.props.info && !this.props.user // first visit to the site
}
_geocode = text => {
const p = this.props
return geocode(text, p.map.accessToken || MBAT, p.geocoder)
}
import React from 'react';
import dynamic from 'next/dynamic';
import { GraphQLError } from 'graphql';
import { Article } from '@leaa/common/src/entrys';
import { GET_ARTICLE_BY_SLUG } from '@leaa/common/src/graphqls';
import { IPageProps, IGetInitialProps } from '@leaa/www/src/interfaces';
import { HtmlMeta, PageCard } from '@leaa/www/src/components';
import { apolloClient } from '@leaa/www/src/libs';
import { messageUtil } from '@leaa/www/src/utils';
const ArticleItem = dynamic(() => import('./_components/ArticleItem/ArticleItem'));
interface IProps extends IPageProps {
pageProps: {
article?: Article;
articleError?: GraphQLError;
};
}
const nextPage = (ctx: IProps) => {
const { article, articleError } = ctx.pageProps;
if (articleError) messageUtil.gqlError(articleError?.message);
if (!article) return null;
return (
import React from 'react';
import dynamic from 'next/dynamic';
const EditProfile = dynamic(() => import('../components/profiles/EditProfile').then((mod: any) => mod.EditProfile), { ssr: false });
import Page from '../layout/Page';
export default () => ;