add mobile improvements

This commit is contained in:
Michael Schramm 2020-06-10 17:36:17 +02:00
parent 0854e63d4f
commit f42e8b9e7c
11 changed files with 74 additions and 29 deletions

View File

@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## UNRELEASED ## UNRELEASED
### Added ### Added
- mobile improvements for lists and home page
### Changed ### Changed
### Fixed ### Fixed
### Security ### Security

View File

@ -0,0 +1,16 @@
.footer {
position: absolute;
bottom: 0;
left: 0;
right: 0;
display: flex;
flex-direction: row;
align-items: center;
@media (max-width: 600px) {
position: relative;
margin-bottom: 16px;
flex-direction: column;
text-align: center;
}
}

View File

@ -7,6 +7,7 @@ import { useTranslation } from 'react-i18next'
import { SETTINGS_QUERY, SettingsQueryData } from '../../graphql/query/settings.query' import { SETTINGS_QUERY, SettingsQueryData } from '../../graphql/query/settings.query'
import { languages } from '../../i18n' import { languages } from '../../i18n'
import { clearAuth, withAuth } from '../with.auth' import { clearAuth, withAuth } from '../with.auth'
import scss from './footer.module.scss'
interface Props { interface Props {
me?: { me?: {
@ -26,16 +27,7 @@ const AuthFooterInner: React.FC<Props> = (props) => {
} }
return ( return (
<footer <footer className={scss.footer}>
style={{
position: 'absolute',
bottom: 0,
left: 0,
right: 0,
display: 'flex',
flexDirection: 'row',
}}
>
<Link href={'/admin'}> <Link href={'/admin'}>
<Button type={'link'} ghost> <Button type={'link'} ghost>
{t('admin')} {t('admin')}
@ -69,6 +61,7 @@ const AuthFooterInner: React.FC<Props> = (props) => {
onChange={(next) => i18n.changeLanguage(next)} onChange={(next) => i18n.changeLanguage(next)}
style={{ style={{
color: '#FFF', color: '#FFF',
paddingLeft: 18,
}} }}
suffixIcon={false} suffixIcon={false}
> >

View File

@ -73,6 +73,7 @@ const Submissions: NextPage = () => {
render(date: string) { render(date: string) {
return <DateTime date={date} /> return <DateTime date={date} />
}, },
responsive: ['lg'],
}, },
{ {
title: t('submission:lastModified'), title: t('submission:lastModified'),
@ -80,6 +81,7 @@ const Submissions: NextPage = () => {
render(date: string) { render(date: string) {
return <TimeAgo date={date} /> return <TimeAgo date={date} />
}, },
responsive: ['lg'],
}, },
] ]

View File

@ -24,6 +24,7 @@ import { NextPage } from 'next'
import Link from 'next/link' import Link from 'next/link'
import React, { useState } from 'react' import React, { useState } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import {useWindowSize} from '../../../components/use.window.size'
import { import {
ADMIN_FORM_DELETE_MUTATION, ADMIN_FORM_DELETE_MUTATION,
AdminFormDeleteMutationData, AdminFormDeleteMutationData,
@ -32,6 +33,7 @@ import {
const Index: NextPage = () => { const Index: NextPage = () => {
const { t } = useTranslation() const { t } = useTranslation()
const { width } = useWindowSize()
const [pagination, setPagination] = useState<PaginationProps>({ const [pagination, setPagination] = useState<PaginationProps>({
pageSize: 25, pageSize: 25,
}) })
@ -84,6 +86,7 @@ const Index: NextPage = () => {
render(live: boolean) { render(live: boolean) {
return <FormIsLive isLive={live} /> return <FormIsLive isLive={live} />
}, },
responsive: ['md'],
}, },
{ {
title: t('form:row.title'), title: t('form:row.title'),
@ -101,6 +104,7 @@ const Index: NextPage = () => {
</Link> </Link>
) )
}, },
responsive: ['lg'],
}, },
{ {
title: t('form:row.language'), title: t('form:row.language'),
@ -108,6 +112,7 @@ const Index: NextPage = () => {
render(lang: string) { render(lang: string) {
return t(`language:${lang}`) return t(`language:${lang}`)
}, },
responsive: ['lg'],
}, },
{ {
title: t('form:row.created'), title: t('form:row.created'),
@ -115,6 +120,7 @@ const Index: NextPage = () => {
render(date: string) { render(date: string) {
return <DateTime date={date} /> return <DateTime date={date} />
}, },
responsive: ['lg'],
}, },
{ {
title: t('form:row.lastModified'), title: t('form:row.lastModified'),
@ -122,13 +128,14 @@ const Index: NextPage = () => {
render(date: string) { render(date: string) {
return <TimeAgo date={date} /> return <TimeAgo date={date} />
}, },
responsive: ['md'],
}, },
{ {
title: t('form:row.menu'), title: t('form:row.menu'),
align: 'right', align: 'right',
render(row: AdminPagerFormEntryQueryData) { render(row: AdminPagerFormEntryQueryData) {
return ( return (
<Space> <Space direction={width < 600 ? 'vertical' : 'horizontal'}>
<Link href={'/admin/forms/[id]/submissions'} as={`/admin/forms/${row.id}/submissions`}> <Link href={'/admin/forms/[id]/submissions'} as={`/admin/forms/${row.id}/submissions`}>
<Tooltip title={'Show Submissions'}> <Tooltip title={'Show Submissions'}>
<Button> <Button>

View File

@ -20,15 +20,15 @@ const Index: NextPage = () => {
return ( return (
<Structure title={t('admin:home')} selected={'home'} loading={loading}> <Structure title={t('admin:home')} selected={'home'} loading={loading}>
<Row gutter={16}> <Row gutter={16}>
<Col span={8}> <Col span-sm={8} span-xs={24}>
<Statistic title={t('statistic:totalForms')} value={data && data.forms.total} /> <Statistic title={t('statistic:totalForms')} value={data && data.forms.total} />
</Col> </Col>
<Col span={8}> <Col span-sm={8} span-xs={24}>
<Statistic title={t('statistic:totalUsers')} value={data && data.users.total} /> <Statistic title={t('statistic:totalUsers')} value={data && data.users.total} />
</Col> </Col>
<Col span={8}> <Col span-sm={8} span-xs={24}>
<Statistic <Statistic
title={t('statistic:totalSubmissions')} title={t('statistic:totalSubmissions')}
value={data && data.submissions.total} value={data && data.submissions.total}

View File

@ -10,6 +10,7 @@ import Link from 'next/link'
import React, { useState } from 'react' import React, { useState } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { DateTime } from '../../../components/date.time' import { DateTime } from '../../../components/date.time'
import {useWindowSize} from '../../../components/use.window.size'
import { UserRole } from '../../../components/user/role' import { UserRole } from '../../../components/user/role'
import { import {
ADMIN_USER_DELETE_MUTATION, ADMIN_USER_DELETE_MUTATION,
@ -24,6 +25,7 @@ import {
} from '../../../graphql/query/admin.pager.user.query' } from '../../../graphql/query/admin.pager.user.query'
const Index: NextPage = () => { const Index: NextPage = () => {
const { width } = useWindowSize()
const { t } = useTranslation() const { t } = useTranslation()
const [pagination, setPagination] = useState<PaginationProps>({ const [pagination, setPagination] = useState<PaginationProps>({
pageSize: 10, pageSize: 10,
@ -76,6 +78,7 @@ const Index: NextPage = () => {
render(roles: string[]) { render(roles: string[]) {
return <UserRole roles={roles} /> return <UserRole roles={roles} />
}, },
responsive: ['md'],
}, },
{ {
title: t('user:row.email'), title: t('user:row.email'),
@ -89,13 +92,14 @@ const Index: NextPage = () => {
render(date: string) { render(date: string) {
return <DateTime date={date} /> return <DateTime date={date} />
}, },
responsive: ['lg'],
}, },
{ {
title: t('user:row.menu'), title: t('user:row.menu'),
align: 'right', align: 'right',
render(row: AdminPagerUserEntryQueryData) { render(row: AdminPagerUserEntryQueryData) {
return ( return (
<Space> <Space direction={width < 600 ? 'vertical' : 'horizontal'}>
<Link href={'/admin/users/[id]'} as={`/admin/users/${row.id}`}> <Link href={'/admin/users/[id]'} as={`/admin/users/${row.id}`}>
<Button type={'primary'}> <Button type={'primary'}>
<EditOutlined /> <EditOutlined />

View File

@ -0,0 +1,11 @@
.otherActions {
width: 100%;
justify-content: center;
display: flex;
@media (max-width: 600px) {
flex-direction: column;
}
}

View File

@ -14,6 +14,7 @@ import Link from 'next/link'
import { useRouter } from 'next/router' import { useRouter } from 'next/router'
import React, { useState } from 'react' import React, { useState } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import scss from './index.module.scss'
const Index: NextPage = () => { const Index: NextPage = () => {
const { t } = useTranslation() const { t } = useTranslation()
@ -90,13 +91,7 @@ const Index: NextPage = () => {
</Button> </Button>
</Form.Item> </Form.Item>
<Button.Group <Button.Group className={scss.otherActions}>
style={{
width: '100%',
justifyContent: 'center',
display: 'flex',
}}
>
<Link href={'/register'}> <Link href={'/register'}>
<Button type={'link'} ghost> <Button type={'link'} ghost>
{t('register')} {t('register')}

View File

@ -0,0 +1,19 @@
.otherActions {
width: 100%;
justify-content: center;
display: flex;
button {
overflow: hidden;
text-overflow: ellipsis;
span {
overflow: hidden;
}
}
@media (max-width: 600px) {
flex-direction: column;
}
}

View File

@ -17,6 +17,7 @@ import React, { useState } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { ErrorPage } from '../components/error.page' import { ErrorPage } from '../components/error.page'
import { SETTINGS_QUERY, SettingsQueryData } from '../graphql/query/settings.query' import { SETTINGS_QUERY, SettingsQueryData } from '../graphql/query/settings.query'
import scss from './register.module.scss'
const Register: NextPage = () => { const Register: NextPage = () => {
const { t } = useTranslation() const { t } = useTranslation()
@ -114,13 +115,7 @@ const Register: NextPage = () => {
</Button> </Button>
</Form.Item> </Form.Item>
<Button.Group <Button.Group className={scss.otherActions}>
style={{
width: '100%',
justifyContent: 'center',
display: 'flex',
}}
>
<Link href={'/login'}> <Link href={'/login'}>
<Button type={'link'} ghost> <Button type={'link'} ghost>
{t('register:gotoLogin')} {t('register:gotoLogin')}