Skip to content

Commit

Permalink
Changed Resumeskillset be documents vs objects for full text search o…
Browse files Browse the repository at this point in the history
…f skill
  • Loading branch information
tmanundercover committed Dec 13, 2023
1 parent 8a4a6ae commit 809fb2d
Show file tree
Hide file tree
Showing 14 changed files with 47 additions and 43 deletions.
2 changes: 2 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions functions.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$/functions" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
5 changes: 2 additions & 3 deletions functions/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "functions",
"version": "0.6.1",
"version": "0.7.0",
"scripts": {
"lint": "eslint --ext .js,.ts .",
"build": "tsc",
"build:dev": "NODE_ENV=development tsc",
"serve": "npm run build && firebase emulators:start --only functions",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell",
"deploy": "npm run build && firebase deploy",
"deploy": "npm run build && npm run html && firebase deploy",
"logs": "firebase functions:log",
"html": "cp ../build/index.html ./lib",
"fonts": "mv ../build/fonts ./lib/functions/src"
Expand All @@ -22,7 +22,6 @@
"@sanity/image-url": "^1.0.2",
"@sanity/types": "^2.34.0",
"@sendgrid/mail": "^7.7.0",
"@shopify/shopify-api": "^8.0.2",
"axios": "^1.6.2",
"dotenv": "^16.3.1",
"es6-promise": "^4.2.8",
Expand Down
6 changes: 2 additions & 4 deletions functions/src/groqQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,10 @@ const HOMEPAGE = `_type,
},
"serviceAmenities": serviceAmenities[]->,
"prosList": prosList[]->,
"skillsets": skillsets[]{
"skillsets": skillsets[]->{
...,
"skills": skills[]->{
_id,
name,
title,
...
},
},
"experiences": experiences[]->{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "the-handsomestnerd-internal",
"version": "0.6.1",
"version": "0.7.0",
"license": "GPL-3.0-or-later",
"private": true,
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion sanityIo.iml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$/sanityIo/sanityIo" />
<content url="file://$MODULE_DIR$/sanityIo" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
4 changes: 2 additions & 2 deletions sanityIo/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sanityIo/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "the-handsomest-nerd-sanity",
"private": true,
"version": "0.6.1",
"version": "0.7.0",
"description": "Sanity CMS for React Website Builder",
"main": "package.json",
"author": "theHandsomestNerd <hello@thehandsomestnerd.com>",
Expand Down
2 changes: 1 addition & 1 deletion sanityIo/sanity.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default defineConfig({
title: "The Handsomest Nerd",
projectId: "e5l5k4i5",
dataset: "development",
plugins: [deskTool(), visionTool()],
plugins: [deskTool({}), visionTool()],
schema: {
types: schemas,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default {
name: 'ResumeSkillset',
title: 'Resume Skillset',
type: 'object',
type: 'document',
fields: [
{
name: 'name',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default {
name: 'skillsets',
title: 'Skillsets',
type: "array",
of: [{type: "ResumeSkillset"},
of: [{type: "reference", to:{type:"ResumeSkillset"}},
]
},
]
Expand Down
6 changes: 2 additions & 4 deletions src/common/sanityIo/groqQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,10 @@ const HOMEPAGE = `_type,
},
"prosList": prosList[]->,
"serviceAmenities": serviceAmenities[]->,
"skillsets": skillsets[]{
"skillsets": skillsets[]->{
...,
"skills": skills[]->{
_id,
name,
title,
...
},
},
"experiences": experiences[]->{
Expand Down
5 changes: 4 additions & 1 deletion src/components/block-content-ui/cmsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,8 @@ const fullTextSearch = (textToSearch: string): Promise<any> => {
`*[
[
title,
careerTitle,
introduction,
name,
contentText,
contentTexts,
Expand All @@ -484,10 +486,10 @@ const fullTextSearch = (textToSearch: string): Promise<any> => {
contentSummaryTitle,
contentSummaryTexts,
videoUrl,
] match '*${textToSearch}*']{
...,
"skillsUsed" : skillsUsed[]->,
"skills" : skills[]->,
}`,
// {searchText: textToSearch}
).then((data: any) => {
Expand All @@ -502,6 +504,7 @@ const skillReferenceSearch = (skill: ResumeSkill): Promise<any> => {
...,
"skillsHighlighted": skillsHighlighted[]->,
"skillsUsed" : skillsUsed[]->,
"skills":skills[]->,
}`,
{searchText: skill._id}
).then((data: any) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,17 @@ import React, {FunctionComponent} from 'react'
import makeStyles from "@mui/styles/makeStyles";
import {Theme} from "@mui/material/styles";
import {Grid, Typography} from "@mui/material";
import {ResumeSkill} from "../../../BlockContentTypes";
import {ResumePortfolioItem, ResumeSkill} from "../../../BlockContentTypes";
import cmsClient from "../../../block-content-ui/cmsClient";
import ResumeExperienceItem from "../resume-experience-section/ResumeExperienceItem";
import {ResumePortfolioItem} from "../../../BlockContentTypes";
import ResumePortfolioEntry from "../resume-portfolio-section/ResumePortfolioEntry";
import PortfolioItemModal from "../resume-portfolio-section/PortfolioItemModal";

export const useStyles = makeStyles((theme: Theme) => ({
root: {
},
}))
import ResumeSkillSetItem from "./ResumeSkillSetItem";

interface IProps {
skill?: ResumeSkill
}

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

const ResumeSkillReferences: FunctionComponent<IProps> = (props: IProps) => {
const [referenceResults, setReferenceResults] = React.useState<[]>()

const searchCMS = async () => {
Expand All @@ -33,7 +25,7 @@ const ResumeSkillReferences: FunctionComponent<IProps> = (props:IProps) => {
}
}

React.useEffect(()=>{
React.useEffect(() => {
// find the rerences of this skill
searchCMS().then()

Expand All @@ -44,17 +36,21 @@ const ResumeSkillReferences: FunctionComponent<IProps> = (props:IProps) => {
const [isOpen, setIsOpen] = React.useState<boolean>(false)
return (<Grid container item spacing={2}>
{
referenceResults?.map((searchResult:any)=>{
switch (searchResult?._type) {
case "ResumeExperience":
return <ResumeExperienceItem experience={searchResult} />
case "ResumePortfolioItem":
return <ResumePortfolioEntry portfolioItem={searchResult}/>
case "ResumeSkillSection":
return <></>
default:
return <Grid item container><Typography>{searchResult._type}</Typography></Grid>
}
referenceResults?.map((searchResult: any) => {
switch (searchResult?._type) {
case "ResumeExperience":
return <ResumeExperienceItem experience={searchResult}/>
case "ResumePortfolioItem":
return <ResumePortfolioEntry portfolioItem={searchResult}/>
case "ResumeSkillSection":
return <></>
case "ResumeSkillset":
return <Grid container item><ResumeSkillSetItem skillset={searchResult}/></Grid>
// case "PortfolioItem":
// return <>{searchResult.title}</>
default:
return <Grid item container><Typography>{searchResult._type}</Typography></Grid>
}
})
}

Expand Down

0 comments on commit 809fb2d

Please sign in to comment.