Skip to content

Commit

Permalink
Merge pull request #443 from urfit-tech/feat/meet-us-header-footer-se…
Browse files Browse the repository at this point in the history
…tting

feat: meeting page add header footer enable setting
  • Loading branch information
aniku777tw authored Oct 24, 2023
2 parents 762475d + 45527f2 commit 5d4671c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
9 changes: 6 additions & 3 deletions src/components/layout/DefaultLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ const StyledNotificationBar = styled.div<{ variant?: string }>`

const DefaultLayout: React.FC<{
white?: boolean
noHeader?: boolean
noFooter?: boolean
noHeader?: boolean | null
noFooter?: boolean | null
noCart?: boolean
noGeneralLogin?: boolean
noNotificationBar?: boolean
Expand Down Expand Up @@ -108,7 +108,10 @@ const DefaultLayout: React.FC<{
/>
)}

<StyledLayoutWrapper variant={white ? 'white' : undefined} header={noHeader ? 'noHeader' : ''}>
<StyledLayoutWrapper
variant={white ? 'white' : undefined}
header={noHeader ? 'noHeader' : '' /* for remove blank on the top */}
>
<StyledLayoutHeader className={`d-flex align-items-center justify-content-between ${noHeader ? 'hidden' : ''}`}>
<div className="d-flex align-items-center">
<LogoBlock className="mr-4">
Expand Down
7 changes: 6 additions & 1 deletion src/pages/LoadingPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Spinner } from '@chakra-ui/react'
import React from 'react'
import styled from 'styled-components'
import { BooleanParam, useQueryParams } from 'use-query-params'
import DefaultLayout from '../components/layout/DefaultLayout'

const StyledDiv = styled.div`
Expand All @@ -11,8 +12,12 @@ const StyledDiv = styled.div`
`

const LoadingPage: React.VFC = () => {
const [{ noHeader }] = useQueryParams({
noHeader: BooleanParam,
})

return (
<DefaultLayout noFooter>
<DefaultLayout noFooter noHeader={noHeader}>
<StyledDiv className="loading">
<Spinner size="lg" />
</StyledDiv>
Expand Down
13 changes: 10 additions & 3 deletions src/pages/MeetingPage/MeetingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import Cookies from 'js-cookie'
import { useApp } from 'lodestar-app-element/src/contexts/AppContext'
import { useState } from 'react'
import { useParams } from 'react-router-dom'
import { BooleanParam } from 'serialize-query-params'
import styled from 'styled-components'
import { useQueryParams } from 'use-query-params'
import DefaultLayout from '../../components/layout/DefaultLayout'
import hasura from '../../hasura'
import LoadingPage from '../LoadingPage'
Expand All @@ -31,8 +33,13 @@ const GetMemberByUsername = gql`
`

const MeetingPage = () => {
const { id: appId, settings } = useApp()
const { id: appId, settings, loading: loadingAppData } = useApp()
const { username: managerUsername } = useParams<{ username: string }>()
const [{ noHeader, noFooter }] = useQueryParams({
noHeader: BooleanParam,
noFooter: BooleanParam,
})

const [isSubmitting, setIsSubmitting] = useState(false)

const categoryCheckboxes = JSON.parse(settings['custom.meeting_page']).categoryCheckboxes as CategoryCheckboxes // array of checkboxes
Expand All @@ -50,7 +57,7 @@ const MeetingPage = () => {

const managerId = managerUsername ? memberData?.member_public[0]?.id || undefined : undefined

if (loading) {
if (loading && loadingAppData) {
return <LoadingPage />
}

Expand Down Expand Up @@ -123,7 +130,7 @@ const MeetingPage = () => {
}

return (
<DefaultLayout centeredBox>
<DefaultLayout centeredBox noFooter={noFooter} noHeader={noHeader}>
<StyledForm onSubmit={handleSubmit}>
<Heading as="h3" size="lg" className="mb-4 text-center">
{managerUsername} 預約連結
Expand Down

0 comments on commit 5d4671c

Please sign in to comment.