Skip to content

Commit

Permalink
fix all errors and removed most console.logs
Browse files Browse the repository at this point in the history
  • Loading branch information
tmanundercover committed Oct 12, 2023
1 parent dcd88b0 commit b94f3c6
Show file tree
Hide file tree
Showing 23 changed files with 408 additions and 619 deletions.
4 changes: 3 additions & 1 deletion sanityIo/schemas/mui/MuiTypography.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ export default {
of:[{type: "string", options: {
list: [
{value: "OSWALD", title: "Oswald"},
{value: "RALEWAY", title: "Raleway"}
{value: "RALEWAY", title: "Raleway"},
{value: "POPPINS", title: "Poppins"},
{value: "MONTESERRAT", title: "Monteserrat"}
]
}}],

Expand Down
1 change: 0 additions & 1 deletion src/components/BusinessCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ const BusinessCard: FunctionComponent<MainMenuProps> = ({anchor, homePage}) => {
return false
})

console.log("Found bio", bioSection[0])
setUserBio(bioSection[0])


Expand Down
8 changes: 2 additions & 6 deletions src/components/FooterBlockContentLayoutContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ const FooterBlockContentLayoutContainer: FunctionComponent<FooterBlockContentLay
const developmentFooter: DevelopmentFooterSectionType = columnLayoutContainer

return (
<StyledEngineProvider injectFirst>
<ThemeProvider theme={WebDevSiteTheme}><Grid key={'BOTTOM_OF_PAGE_DEV'} container item
<ThemeProvider key={'BOTTOM_OF_PAGE_DEV'} theme={WebDevSiteTheme}><Grid container item
xs={12}
>
<Link id={"BOTTOM_OF_PAGE"} underline="hover"><></>
Expand All @@ -78,22 +77,19 @@ const FooterBlockContentLayoutContainer: FunctionComponent<FooterBlockContentLay
pageFooter={developmentFooter.footerMenuRef}
/>
</Grid></ThemeProvider>
</StyledEngineProvider>
);
case 'FooterSection':
const footer: FooterSectionType = columnLayoutContainer

return (
<StyledEngineProvider injectFirst>
<ThemeProvider theme={TheWebsiteTheme}><Grid key={'BOTTOM_OF_PAGE'} container item xs={12}
<ThemeProvider key={'BOTTOM_OF_PAGE'} theme={TheWebsiteTheme}><Grid container item xs={12}
>
<Link id={"BOTTOM_OF_PAGE"} underline="hover"><></>
</Link>
<Footer
pageFooter={footer.footerMenuRef}
/>
</Grid></ThemeProvider>
</StyledEngineProvider>
);
default:
return <span key={index}>Undefined section {columnLayoutContainer._type}</span>
Expand Down
4 changes: 2 additions & 2 deletions src/components/HeaderBlockContentLayoutContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const HeaderBlockContentLayoutContainer: FunctionComponent<HeaderBlockContentLay
const developmentHeader: DevelopmentHeaderSectionType = columnLayoutContainer

return (
<ThemeProvider theme={WebDevSiteTheme}><Grid key={'TOP_OF_PAGE_DEV'} container item xs={12} style={{height: WebDevSiteTheme.mixins.toolbar.height}} alignContent='center' alignItems='center'>
<ThemeProvider theme={WebDevSiteTheme} key={'TOP_OF_PAGE_DEV'}><Grid container item xs={12} style={{height: WebDevSiteTheme.mixins.toolbar.height}} alignContent='center' alignItems='center'>
<Link id={"TOP_OF_PAGE"} underline="hover"><></>
</Link>
<DevelopmentHeader
Expand All @@ -94,7 +94,7 @@ const HeaderBlockContentLayoutContainer: FunctionComponent<HeaderBlockContentLay
const header: HeaderSectionType = columnLayoutContainer

return (
<ThemeProvider theme={TheWebsiteTheme}><Grid key={'TOP_OF_PAGE'} container item xs={12} style={{height: TheWebsiteTheme.mixins.toolbar.height}}>
<ThemeProvider theme={TheWebsiteTheme} key={'TOP_OF_PAGE'}><Grid container item xs={12} style={{height: TheWebsiteTheme.mixins.toolbar.height}}>
<Link id={"TOP_OF_PAGE"} underline="hover"><></>
</Link>
<Header
Expand Down
5 changes: 2 additions & 3 deletions src/components/amenity-context/AmenityProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,15 @@ const AmenityProvider: FunctionComponent<IProps & PropsWithChildren> = (
const pageContext = useContext(PageContext)

React.useEffect(() => {
console.log("Generating amenities", pageContext.page?.servicesAvailable)
pageContext.page?.servicesAvailable?.map((service) => {
const serviceElements = generateAmenitiesElement(service.serviceAmenities, service.slug.current, service.contentTitle)
console.log("Generated amenties", serviceElements, service.slug.current)
// console.log("Generated amenties", serviceElements, service.slug.current)
dispatch({type: "ADD_ELEMENTS", payload: {serviceId: service.slug.current, elements: serviceElements}})
})
}, [pageContext.page?.servicesAvailable])

const generateAmenitiesElement = (amenities: any[], serviceSlug: string, serviceTitle: string) => {
console.log(" generate", serviceSlug, state.serviceId)
// console.log(" generate", serviceSlug, state.serviceId)
// if(serviceSlug === state.serviceId)
const newElements = amenities?.map((serviceAmenity: ServiceAmenityType) => {
return <ListItem
Expand Down
18 changes: 14 additions & 4 deletions src/components/block-content-ui/cmsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
SanityBlog,
SanityBlogCategory,
SanityBlogGroup, SanityBlogPreview,
SanityLandingPage, SanityMenuContainer,
SanityLandingPage, SanityMenuContainer, SanityMuiTheme,
SanityRef, SanityTransformHwHomePage
} from '../../common/sanityIo/Types'

Expand Down Expand Up @@ -67,6 +67,16 @@ const fetchBlogPost = (slug: string): Promise<SanityBlog> => {
})
}

const fetchMuiTheme = (slug: string): Promise<SanityMuiTheme> => {
return sanityClient
.fetch(
`*[_type=="MuiTheme" && slug.current == $slug]`,
{slug}
).then((data: SanityMuiTheme[]) => {
return data[0]
})
}

const fetchLatestBlogPostPreview = (): Promise<SanityBlogPreview> => {
return sanityClient
.fetch(
Expand Down Expand Up @@ -294,13 +304,12 @@ const fetchRefs = async (sanityRefs: SanityRef[]): Promise<any> => {
}

const useFetchPageBySlugQuery = (slug: string) => {
console.log("slug", slug)
// console.log("slug", slug)
return useQuery(
['fetchPageBySlug', slug],
async ({queryKey}) => {
const [_, pageSlug] = queryKey

console.log(" Lookin for page with slug", pageSlug, queryKey)
if (pageSlug && pageSlug.length > 0) {
return sanityClient
.fetch(
Expand Down Expand Up @@ -475,5 +484,6 @@ export default {
useFetchMenuBySlugQuery,
useFetchServicesQuery,
useFetchRefsQuery,
useFetchMenuByRefQuery
useFetchMenuByRefQuery,
fetchMuiTheme
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {Theme} from "@mui/material/styles";

export type CustomizedThemeContextType = {
customizedTheme?: any
getThemeBySlug?: (slug:string)=> Promise<Partial<Theme>>
};

const CustomizedThemeContext = React.createContext<CustomizedThemeContextType>({});
Expand Down
Loading

0 comments on commit b94f3c6

Please sign in to comment.