mirror of
https://github.com/IT4Change/ohmyform-ui.git
synced 2025-12-13 09:45:50 +00:00
improvements
This commit is contained in:
parent
c793321ecb
commit
94f1de3e25
@ -18,7 +18,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
- combined notificationts to become more versatile
|
||||
- use exported hooks for graphql
|
||||
|
||||
- disable swipe gesture
|
||||
|
||||
### Fixed
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { Button, Select } from 'antd'
|
||||
import getConfig from 'next/config'
|
||||
import Link from 'next/link'
|
||||
import { useRouter } from 'next/router'
|
||||
import React from 'react'
|
||||
@ -7,12 +6,9 @@ import GitHubButton from 'react-github-button'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useSettingsQuery } from '../../graphql/query/settings.query'
|
||||
import { languages } from '../../i18n'
|
||||
import { NextConfigType } from '../../next.config.type'
|
||||
import { clearAuth, withAuth } from '../with.auth'
|
||||
import scss from './footer.module.scss'
|
||||
|
||||
const { publicRuntimeConfig } = getConfig() as NextConfigType
|
||||
|
||||
interface Props {
|
||||
me?: {
|
||||
id: string
|
||||
@ -42,7 +38,6 @@ const AuthFooterInner: React.FC<Props> = (props) => {
|
||||
<Link key={'admin'} href={'/admin'}>
|
||||
<Button
|
||||
type={'link'}
|
||||
ghost
|
||||
style={{
|
||||
color: '#FFF',
|
||||
}}
|
||||
@ -54,7 +49,6 @@ const AuthFooterInner: React.FC<Props> = (props) => {
|
||||
<Link key={'profile'} href={'/admin/profile'}>
|
||||
<Button
|
||||
type={'link'}
|
||||
ghost
|
||||
style={{
|
||||
color: '#FFF',
|
||||
}}
|
||||
@ -65,7 +59,6 @@ const AuthFooterInner: React.FC<Props> = (props) => {
|
||||
<Button
|
||||
key={'logout'}
|
||||
type={'link'}
|
||||
ghost
|
||||
onClick={logout}
|
||||
style={{
|
||||
color: '#FFF',
|
||||
@ -78,7 +71,6 @@ const AuthFooterInner: React.FC<Props> = (props) => {
|
||||
<Link href={'/login'} key={'login'}>
|
||||
<Button
|
||||
type={'link'}
|
||||
ghost
|
||||
style={{
|
||||
color: '#FFF',
|
||||
}}
|
||||
@ -90,7 +82,6 @@ const AuthFooterInner: React.FC<Props> = (props) => {
|
||||
<Link href={'/register'} key={'register'}>
|
||||
<Button
|
||||
type={'link'}
|
||||
ghost
|
||||
style={{
|
||||
color: '#FFF',
|
||||
}}
|
||||
@ -124,7 +115,6 @@ const AuthFooterInner: React.FC<Props> = (props) => {
|
||||
type={'link'}
|
||||
target={'_blank'}
|
||||
rel={'noreferrer'}
|
||||
ghost
|
||||
href={'https://www.ohmyform.com'}
|
||||
style={{
|
||||
color: '#FFF',
|
||||
@ -136,7 +126,6 @@ const AuthFooterInner: React.FC<Props> = (props) => {
|
||||
type={'link'}
|
||||
target={'_blank'}
|
||||
rel={'noreferrer'}
|
||||
ghost
|
||||
href={'https://lokalise.com/'}
|
||||
style={{
|
||||
color: '#FFF',
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { message } from 'antd'
|
||||
import ExcelJS from 'exceljs'
|
||||
import ExcelJS, { CellValue } from 'exceljs'
|
||||
import { useCallback, useState } from 'react'
|
||||
import { SubmissionFragment } from '../../../graphql/fragment/submission.fragment'
|
||||
import { useFormQuery } from '../../../graphql/query/form.query'
|
||||
@ -53,8 +53,8 @@ export const ExportSubmissionAction: React.FC<Props> = (props) => {
|
||||
start: 0,
|
||||
})
|
||||
|
||||
const buildRow = (data: SubmissionFragment): any[] => {
|
||||
const row = [
|
||||
const buildRow = (data: SubmissionFragment): CellValue[] => {
|
||||
const row: CellValue[] = [
|
||||
data.id,
|
||||
data.created,
|
||||
data.lastModified,
|
||||
@ -66,8 +66,9 @@ export const ExportSubmissionAction: React.FC<Props> = (props) => {
|
||||
|
||||
data.fields.forEach((field) => {
|
||||
try {
|
||||
const decoded = JSON.parse(field.value)
|
||||
row.push(decoded.value)
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const decoded: { value: CellValue } = JSON.parse(field.value)
|
||||
row.push(decoded.value || '')
|
||||
} catch (e) {
|
||||
row.push('')
|
||||
}
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
import { ApolloClient, from, HttpLink, InMemoryCache } from '@apollo/client'
|
||||
import { NormalizedCacheObject } from '@apollo/client/cache/inmemory/types'
|
||||
import { setContext } from '@apollo/client/link/context'
|
||||
import 'isomorphic-fetch'
|
||||
import getConfig from 'next/config'
|
||||
import { NextConfigType } from '../next.config.type'
|
||||
|
||||
let client: ApolloClient<any>
|
||||
let client: ApolloClient<NormalizedCacheObject>
|
||||
|
||||
const getClient = (): ApolloClient<any> => {
|
||||
const getClient = (): ApolloClient<NormalizedCacheObject> => {
|
||||
if (!client) {
|
||||
const config = getConfig() as NextConfigType
|
||||
|
||||
@ -14,7 +15,7 @@ const getClient = (): ApolloClient<any> => {
|
||||
|
||||
const { publicRuntimeConfig, serverRuntimeConfig } = config
|
||||
|
||||
client = new ApolloClient({
|
||||
client = new ApolloClient<NormalizedCacheObject>({
|
||||
cache: new InMemoryCache(),
|
||||
link: from([
|
||||
setContext((request, context) => {
|
||||
|
||||
@ -3,21 +3,14 @@ import 'antd/dist/antd.css'
|
||||
import 'assets/global.scss'
|
||||
import 'assets/variables.scss'
|
||||
import 'i18n'
|
||||
import { AppInitialProps } from 'next/app'
|
||||
import getConfig from 'next/config'
|
||||
import App, { AppInitialProps } from 'next/app'
|
||||
import { AppType } from 'next/dist/next-server/lib/utils'
|
||||
import Head from 'next/head'
|
||||
import React from 'react'
|
||||
import { wrapper } from 'store'
|
||||
import getClient from '../graphql/client'
|
||||
|
||||
const { publicRuntimeConfig } = getConfig() as {
|
||||
publicRuntimeConfig: {
|
||||
endpoint: string
|
||||
}
|
||||
}
|
||||
|
||||
const App: AppType = ({ Component, pageProps }) => {
|
||||
const MyApp: AppType = ({ Component, pageProps }) => {
|
||||
return (
|
||||
<ApolloProvider client={getClient()}>
|
||||
<Head>
|
||||
@ -29,8 +22,6 @@ const App: AppType = ({ Component, pageProps }) => {
|
||||
)
|
||||
}
|
||||
|
||||
App.getInitialProps = (): AppInitialProps => ({
|
||||
pageProps: {},
|
||||
})
|
||||
MyApp.getInitialProps = (context): Promise<AppInitialProps> => App.getInitialProps(context as any)
|
||||
|
||||
export default wrapper.withRedux(App)
|
||||
export default wrapper.withRedux(MyApp)
|
||||
|
||||
@ -14,11 +14,7 @@ import { Omf } from '../../../components/omf'
|
||||
import { useSubmission } from '../../../components/use.submission'
|
||||
import { useFormPublicQuery } from '../../../graphql/query/form.public.query'
|
||||
|
||||
interface Props {
|
||||
id: string
|
||||
}
|
||||
|
||||
const Index: NextPage<Props> = () => {
|
||||
const Index: NextPage = () => {
|
||||
const { t, i18n } = useTranslation()
|
||||
const router = useRouter()
|
||||
const id = router.query.id as string
|
||||
@ -67,6 +63,7 @@ const Index: NextPage<Props> = () => {
|
||||
direction: 'vertical',
|
||||
allowSlideNext: false,
|
||||
allowSlidePrev: true,
|
||||
noSwiping: true,
|
||||
updateOnWindowResize: true,
|
||||
}
|
||||
|
||||
@ -147,10 +144,4 @@ const Index: NextPage<Props> = () => {
|
||||
)
|
||||
}
|
||||
|
||||
Index.getInitialProps = ({ query }) => {
|
||||
return {
|
||||
id: query.id as string,
|
||||
}
|
||||
}
|
||||
|
||||
export default Index
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user