2021-03-22 16:32:59 +03:00
|
|
|
import LayoutMain from 'components/layout/layout-main'
|
2021-05-08 09:13:55 +03:00
|
|
|
import { NextPage } from 'next'
|
|
|
|
import { applyTree } from 'libs/server/middlewares/tree'
|
|
|
|
import { applyUA } from 'libs/server/middlewares/ua'
|
2021-03-22 16:32:59 +03:00
|
|
|
import { TreeModel } from 'libs/shared/tree'
|
2021-05-08 09:13:55 +03:00
|
|
|
import { useSession } from 'libs/server/middlewares/session'
|
|
|
|
import { applySettings } from 'libs/server/middlewares/settings'
|
|
|
|
import { applyAuth } from 'libs/server/middlewares/auth'
|
2021-05-09 04:41:33 +03:00
|
|
|
import { SettingsContainer } from 'components/settings/settings-container'
|
2021-04-25 15:06:38 +03:00
|
|
|
import useI18n from 'libs/web/hooks/use-i18n'
|
2021-05-08 09:13:55 +03:00
|
|
|
import { applyCsrf } from 'libs/server/middlewares/csrf'
|
2021-05-03 12:05:49 +03:00
|
|
|
import { SettingFooter } from 'components/settings/setting-footer'
|
2021-05-08 09:13:55 +03:00
|
|
|
import { SSRContext, ssr } from 'libs/server/connect'
|
2021-03-22 16:32:59 +03:00
|
|
|
|
2021-03-25 17:32:51 +03:00
|
|
|
const SettingsPage: NextPage<{ tree: TreeModel }> = ({ tree }) => {
|
2021-04-25 15:06:38 +03:00
|
|
|
const { t } = useI18n()
|
|
|
|
|
2021-03-22 16:32:59 +03:00
|
|
|
return (
|
|
|
|
<LayoutMain tree={tree}>
|
2021-05-03 12:05:49 +03:00
|
|
|
<section className="py-40 h-full overflow-y-auto">
|
|
|
|
<div className="px-6 prose m-auto">
|
|
|
|
<h1>
|
|
|
|
<span className="font-normal">{t('Settings')}</span>
|
|
|
|
</h1>
|
2021-03-25 17:32:51 +03:00
|
|
|
|
2021-05-09 04:41:33 +03:00
|
|
|
<SettingsContainer />
|
2021-05-03 12:05:49 +03:00
|
|
|
<SettingFooter />
|
|
|
|
</div>
|
|
|
|
</section>
|
2021-03-22 16:32:59 +03:00
|
|
|
</LayoutMain>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2021-03-25 17:32:51 +03:00
|
|
|
export default SettingsPage
|
2021-03-22 16:32:59 +03:00
|
|
|
|
2021-05-08 09:13:55 +03:00
|
|
|
export const getServerSideProps = async (ctx: SSRContext) => {
|
|
|
|
await ssr()
|
|
|
|
.use(useSession)
|
|
|
|
.use(applyAuth)
|
|
|
|
.use(applyTree)
|
|
|
|
.use(applySettings)
|
|
|
|
.use(applyCsrf)
|
|
|
|
.use(applyUA)
|
|
|
|
.run(ctx.req, ctx.res)
|
|
|
|
|
|
|
|
return {
|
|
|
|
props: ctx.req.props,
|
|
|
|
redirect: ctx.req.redirect,
|
|
|
|
}
|
|
|
|
}
|