Skip to content

Commit

Permalink
componentization and full search expansion for resume items
Browse files Browse the repository at this point in the history
  • Loading branch information
tmanundercover committed Dec 5, 2023
1 parent b16e31d commit be96cb2
Show file tree
Hide file tree
Showing 12 changed files with 436 additions and 193 deletions.
25 changes: 22 additions & 3 deletions src/components/block-content-ui/cmsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
SanityRef, SanityTransformHwHomePage
} from '../../common/sanityIo/Types'

import {ThwServiceItemType, WhySwitchSectionType} from "../BlockContentTypes";
import {ResumeSkill, ThwServiceItemType, WhySwitchSectionType} from "../BlockContentTypes";
import GroqQueries from "../../common/sanityIo/groqQueries";
import groqQueries from "../../common/sanityIo/groqQueries";
import {SanityHomePage} from "./static-pages/cmsStaticPagesClient";
Expand Down Expand Up @@ -483,16 +483,35 @@ const fullTextSearch = (textToSearch: string): Promise<any> => {
contentWelcomeMessage,
contentSummaryTitle,
contentSummaryTexts,
videoUrl
] match '*${textToSearch}*']`,
videoUrl,
] match '*${textToSearch}*']{
...,
"skillsUsed" : skillsUsed[]->,
}`,
// {searchText: textToSearch}
).then((data: any) => {
console.log("data from fulltext search", data)
return data
})
}
const skillReferenceSearch = (skill: ResumeSkill): Promise<any> => {
return sanityClient
.fetch(
`*[references($searchText)]{
...,
"skillsHighlighted": skillsHighlighted[]->,
"skillsUsed" : skillsUsed[]->,
}`,
{searchText: skill._id}
).then((data: any) => {
console.log("data from skillReference search", data)
return data
})
}

export default {
skillReferenceSearch,
fetchRef,
fetchRefs,
fetchLandingPage,
Expand Down
42 changes: 32 additions & 10 deletions src/components/templates/mackenzies-mind/header/FullTextSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@ import makeStyles from "@mui/styles/makeStyles";
import {Theme} from "@mui/material/styles";
import {
AnimatedAboutUsSectionType,
HeroAnimatedContentSectionType,
HeroAnimatedContentSectionType, ResumeExperience, ResumeExperienceSectionType, ResumeSkill, ResumeSkillSet,
SanityHeroContentSlide,
ServiceItemNoRefType
} from "../../../BlockContentTypes";
import ResumeExperienceSection from "../../my-digital-resume/resume-experience-section/ResumeExperienceSection";
import ResumeExperienceItem from "../../my-digital-resume/resume-experience-section/ResumeExperienceItem";
import {COLORS} from "../../../../theme/common/ColorPalette";
import ResumeSkillsSection from "../../my-digital-resume/resume-skills-section/ResumeSkillsSection";
import ResumeSkillSetItem from "../../my-digital-resume/resume-skills-section/ResumeSkillSetItem";
import ResumeSkillReferences from "../../my-digital-resume/resume-skills-section/ResumeSkillReferences";

export const useStyles = makeStyles((theme: Theme) => ({
endAdornedInput: {
Expand Down Expand Up @@ -61,7 +67,7 @@ const FullTextSearch: FunctionComponent<IProps> = (props: IProps) => {
setSearchText(event.target.value)
}

return (<Grid container item>
return (<Grid container item >
<Grid container>

<TextField fullWidth
Expand All @@ -88,13 +94,13 @@ const FullTextSearch: FunctionComponent<IProps> = (props: IProps) => {
,
}}/>
</Grid>
{<Grid container>
{<Grid container style={{overflow: "scroll", height: "800px"}}>
<Grid item>

{results?.length && <Typography
color='textSecondary'>{results?.length} {(results?.length ?? 1) > 1 ? "results" : "result"}</Typography>}
</Grid>
<Grid item container sx={{paddingX: "16px"}}>
<Grid item container sx={{paddingX: "16px",}}>
{results?.map((theResult: any) => {
switch (theResult?._type) {
case "ServiceItem":
Expand All @@ -117,7 +123,7 @@ const FullTextSearch: FunctionComponent<IProps> = (props: IProps) => {
Show:</Typography></Grid>
<Grid item sx={{paddingLeft: "16px"}} container>
{/*<Grid container item><Typography color='textSecondary'*/}
{/* fontWeight={'bold'}>{convertedAnimatedServicesSection.title}</Typography></Grid>*/}
{/* fontWeight={'bold'}>{convertedResumeSkill.title}</Typography></Grid>*/}
{convertedAnimatedHeroSection.contentSlides.map((slide: SanityHeroContentSlide) => {
return <Grid container item sx={{
borderLeft: "1px solid whitesmoke",
Expand Down Expand Up @@ -149,7 +155,7 @@ const FullTextSearch: FunctionComponent<IProps> = (props: IProps) => {
<Grid container item><Typography
color='textSecondary'>{convertedAnimatedServicesSection.contentPreTitle}-{convertedAnimatedServicesSection.contentTitle}</Typography></Grid>
{/*<Grid container item><Typography color='textSecondary'*/}
{/* fontWeight={'bold'}>{convertedAnimatedServicesSection.title}</Typography></Grid>*/}
{/* fontWeight={'bold'}>{convertedResumeSkill.title}</Typography></Grid>*/}
{convertedAnimatedServicesSection.contentTexts.map((textContent: string) => {
return <Grid container item sx={{
borderLeft: "1px solid whitesmoke",
Expand All @@ -164,16 +170,32 @@ const FullTextSearch: FunctionComponent<IProps> = (props: IProps) => {
})}
</Grid>
</Grid>
case "ResumeExperience":
const convertedResumeExperience: ResumeExperience = theResult;

console.log(convertedResumeExperience)
return <Grid container sx={{marginBottom: "16px", backgroundColor:COLORS.LIGHTGRAY, padding: "16px"}}>
<Grid container>
<Typography variant='h6' gutterBottom color='primary'>My Experience</Typography>
</Grid>
<ResumeExperienceItem experience={convertedResumeExperience}/>
</Grid>
case "ResumeSkill":
const convertedResumeSkill: ResumeSkill = theResult;

console.log(convertedResumeSkill)
return <Grid container sx={{marginBottom: "16px", backgroundColor:COLORS.LIGHTGRAY, padding: "16px"}}>
<Grid container>
<Typography variant='h6' gutterBottom color='primary'>My Skill - {convertedResumeSkill.title}</Typography>
</Grid>
<ResumeSkillReferences skill={convertedResumeSkill} />
</Grid>
default:
return <Grid container sx={{marginBottom: "16px"}}><Typography
color='textSecondary'>{theResult?._type}</Typography></Grid>
}

})}


</Grid>

</Grid>}
</Grid>)
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/templates/mackenzies-mind/header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ const Header: FunctionComponent<HeaderProps> = (props) => {
setIsSearchOpen(false)
}}/>
</Grid>
<Grid container justifyContent='center' alignContent='center' alignItems='center' paddingX={'32px'}
style={{height: "100%"}}>
<Grid container item justifyContent='center' alignContent='center' alignItems='center' paddingX={'32px'}
>
<FullTextSearch/>
</Grid>
</Grid>
Expand Down
33 changes: 17 additions & 16 deletions src/components/templates/mackenzies-mind/header/MainMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const MainMenu: FunctionComponent<MainMenuProps> = ({menu, anchor}) => {
default:
const menuItem: SanityMenuItem = subMenu
return <List style={{padding: 0}} key={menuItem.displayText}>
<ListItem href={menuItem.url ?? ""} className={classes.listItem} button>
<ListItem className={classes.listItem}>
<Button variant='text' href={menuItem.isModalButton ? undefined : menuItem.url}
onClick={menuItem.isModalButton ? () => {
// console.log()
Expand All @@ -70,13 +70,11 @@ const MainMenu: FunctionComponent<MainMenuProps> = ({menu, anchor}) => {
}
} : undefined}
style={{
paddingTop: theme.spacing(2.25),
paddingLeft: theme.spacing(2),
paddingBottom: theme.spacing(2.25),
padding: theme.spacing(2.25, 2),
height: "100%",
margin: 0
}} fullWidth>
<ListItemText secondary={<Typography color={'primary'}>{menuItem.displayText}</Typography>}/>
<ListItemText
secondary={<Typography color={'primary'}>{menuItem.displayText}</Typography>}/>
</Button>

</ListItem>
Expand All @@ -98,22 +96,25 @@ const MainMenu: FunctionComponent<MainMenuProps> = ({menu, anchor}) => {
<Drawer anchor={anchor} open={isDrawerOpen}
onClose={toggleDrawer(anchor, false)}
>
<Grid container alignItems='center' justifyContent='space-between'
<Grid container alignItems='center'
style={{
paddingLeft: theme.spacing(4),
paddingRight: theme.spacing(6),
// paddingRight: theme.spacing(6),
}}>

<Grid item xs={11}>

<Logo logoImageSrc={menu.logoImageSrc} logoText={'James Terrell Singleton'}/>
<Grid item xs={10} >
<Logo logoImageSrc={menu.logoImageSrc} logoText={menu.logoText} logoAccentText={"."}/>
</Grid>
<Grid item xs={2} container justifyContent='flex-end' >
<Button onClick={() => {
setIsDrawerOpen(false)
}}>
<Close color='primary' fontSize='large'/>
</Button>
</Grid>
<Grid item xs={1}><Button onClick={() => {
setIsDrawerOpen(false)
}}><Close color='primary' fontSize='large'/></Button></Grid>
</Grid>
{list(anchor)}
</Drawer></Grid>
</Drawer>
</Grid>
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import React, {FunctionComponent} from 'react'

import makeStyles from "@mui/styles/makeStyles";
import { Theme} from "@mui/material/styles";
import {Chip, Grid, Typography, useTheme} from "@mui/material";
import {COLORS} from "../../../../theme/common/ColorPalette";
import {ResumeExperience} from "../../../BlockContentTypes";

export const useStyles = makeStyles((theme: Theme) => ({
root: {
},
}))

interface IProps {
experience: ResumeExperience
}

const ResumeExperienceItem: FunctionComponent<IProps> = (props:IProps) => {
const classes = useStyles()

const theme = useTheme()

React.useEffect(()=>{
}, [])

return (<Grid item container alignContent='flex-start'
role={'experiencedivider'}
// style={{
// borderBottom: `1px solid ${index2 >= (props.sectionData.experiences?.length ?? 0) - 1 ? "transparent" : COLORS.LIGHTGRAY}`,
// // padding: theme.spacing(1.75, 0)
// }}
xs={12}>
<Grid container item role={'experienceheader'}>
<Grid item xs={12} md={4}>
<Typography display='inline'
variant='body2'>{props.experience.companyName}</Typography>
</Grid>
<Grid item xs={6} md={4}>

<Typography display='inline'
variant='body1'>{props.experience.title}</Typography>
</Grid>
<Grid item xs={6} md={4}>

<Typography display='inline'
variant='subtitle1'>{props.experience.companySubtitle}</Typography>
</Grid>
</Grid>
<Grid container item>


<Grid item sm={4}>
<Typography display='inline'
variant='body1'>{props.experience.dateStart?.toString().replaceAll('-', '.')}</Typography>

{/*</Grid>*/}
{/*<Grid item xs={1} container justifyContent='center'>*/}
<Typography display='inline'
variant='body1' style={{margin: theme.spacing(0, 1)}}></Typography>

{/*</Grid>*/}
{/*<Grid item xs={2} container>*/}
<Typography display='inline'
variant='body1'>{props.experience.dateEnd?.toString().replaceAll('-', '.')}</Typography>

</Grid>

</Grid>
<Grid container item>
<Typography
variant='body1' gutterBottom>{props.experience.description}</Typography>
</Grid>
<Grid container item spacing={1}
style={{overflowX: "scroll", paddingBottom: theme.spacing(1)}} wrap='nowrap'>
{
props.experience.skillsUsed?.map((skill, index) => {
console.log(skill)
return <Grid item key={index}><Chip role={'experienceskill'} size='small'
color='primary'
label={skill.title}/></Grid>
})
}
</Grid>
</Grid>)
}

export default ResumeExperienceItem
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {Chip, Grid, Typography, useMediaQuery, useTheme} from '@mui/material'
import {ResumeExperience, ResumeExperienceSectionType} from "../../../BlockContentTypes";
import useThwCommonStyles from "../../../../common/sanityIo/ThwCommonStyles";
import {COLORS} from "../../../../theme/common/ColorPalette";
import ResumeExperienceItem from "./ResumeExperienceItem";

interface IProps {
sectionData: ResumeExperienceSectionType
Expand Down Expand Up @@ -34,63 +35,7 @@ const ResumeExperienceSection: FunctionComponent<IProps> = (props: IProps) => {
<Grid item container md={8} spacing={2} justifyContent={xsOnly ? 'center' : 'flex-start'}>
{
props.sectionData.experiences?.map((experience: ResumeExperience, index2: number) => {
return <Grid key={index2} item container alignContent='flex-start'
role={'experiencedivider'}
style={{
borderBottom: `1px solid ${index2 >= (props.sectionData.experiences?.length ?? 0) - 1 ? "transparent" : COLORS.LIGHTGRAY}`,
// padding: theme.spacing(1.75, 0)
}} xs={12}>
<Grid container item role={'experienceheader'}>
<Grid item xs={12} md={4}>
<Typography display='inline'
variant='body2'>{experience.companyName}</Typography>
</Grid>
<Grid item xs={6} md={4}>

<Typography display='inline'
variant='body1'>{experience.title}</Typography>
</Grid>
<Grid item xs={6} md={4}>

<Typography display='inline'
variant='subtitle1'>{experience.companySubtitle}</Typography>
</Grid>
</Grid>
<Grid container item>


<Grid item sm={4}>
<Typography display='inline'
variant='body1'>{experience.dateStart?.toString().replaceAll('-', '.')}</Typography>

{/*</Grid>*/}
{/*<Grid item xs={1} container justifyContent='center'>*/}
<Typography display='inline'
variant='body1' style={{margin: theme.spacing(0, 1)}}></Typography>

{/*</Grid>*/}
{/*<Grid item xs={2} container>*/}
<Typography display='inline'
variant='body1'>{experience.dateEnd?.toString().replaceAll('-', '.')}</Typography>

</Grid>

</Grid>
<Grid container item>
<Typography
variant='body1' gutterBottom>{experience.description}</Typography>
</Grid>
<Grid container item spacing={1}
style={{overflowX: "scroll", paddingBottom: theme.spacing(1)}} wrap='nowrap'>
{
experience.skillsUsed?.map((skill, index) => {
return <Grid item key={index}><Chip role={'experienceskill'} size='small'
color='primary'
label={skill.title}/></Grid>
})
}
</Grid>
</Grid>
return <ResumeExperienceItem experience={experience} />
})
}
</Grid>
Expand Down
Loading

0 comments on commit be96cb2

Please sign in to comment.