Skip to content

Commit

Permalink
lint etc
Browse files Browse the repository at this point in the history
  • Loading branch information
nofurtherinformation committed Jul 29, 2024
1 parent a459366 commit d7493ea
Show file tree
Hide file tree
Showing 26 changed files with 1,976 additions and 1,494 deletions.
3 changes: 2 additions & 1 deletion app/map/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ export const metadata = {

export default async function MapPage() {
const pageInfo = await getMdxContent("page", "map.mdx")
// @ts-ignore
const contentSections = pageInfo.data.page.sections

return (
<>
<Map contentSections={contentSections} />
Expand Down
92 changes: 46 additions & 46 deletions app/playground/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,52 @@
// import { MemoryMonitor } from "components/dev/MemoryMonitor"
// import { globals } from "utils/state/globals"

// export const primaryColumns = [
// "gravity_2021_weighted",
// "gravity_2023_percentile",
// "gravity_2023_state_percentile",
// "hhi_2023_weighted",
// "hhi_2023_percentile",
// "hhi_2023_state_percentile",
// "segregation_ICE_Black_Alone_White_Alone_weighted",
// "segregation_2023_percentile",
// "segregation_2023_state_percentile",
// "GEOID",
// "NAME",
// "TOTAL_POPULATION",
// "NH_WHITE_ALONE",
// "NH_BLACK_ALONE",
// "NH_AMERICAN_INDIAN_ALONE",
// "NH_ASIAN_ALONE",
// "NH_PACIFIC_ISLANDER_ALONE",
// "NH_SOME_OTHER_RACE",
// "NH_TWO_OR_MORE",
// "NH_TWO_OR_MORE_INCLUDING_SOME_OTHER",
// "NH_TWO_OR_MORE_EXCLUDING_SOME_OTHER",
// "HISPANIC_OR_LATINO",
// "PCT NH WHITE",
// "PCT_NH_BLACK",
// "PCT_NH_AMERICAN_INDIAN",
// "PCT_NH_ASIAN",
// "PCT_NH_PACIFIC_ISLANDER",
// "PCT_NH_SOME_OTHER",
// "PCT_NH_TWO_OR_MORE",
// "PCT_NH_TWO_OR_MORE_INCLUDING_SOME_OTHER",
// "PCT_NH_TWO_OR_MORE_EXCLUDING_SOME_OTHER",
// "PCT_HISPANIC_OR_LATINO",
// "WITH_A_DISABILITY_TOTAL",
// "PCT_WITH_A_DISABILITY",
// "PCT_SNAP_ASSISTANCE",
// "MEDIAN_AGE",
// "POVERTY_RATE",
// "MEDIAN_HOUSEHOLD_INCOME",
// "NO_HEALTHCARE_TOTAL",
// "PCT_NO_HEALTHCARE",
// "ADI_NATRANK",
// "ADI_STATERNK",
// "UNIT",
// "UNIT_PLURAL",
// ] as const
export const primaryColumns = [
"gravity_2021_weighted",
"gravity_2023_percentile",
"gravity_2023_state_percentile",
"hhi_2023_weighted",
"hhi_2023_percentile",
"hhi_2023_state_percentile",
"segregation_ICE_Black_Alone_White_Alone_weighted",
"segregation_2023_percentile",
"segregation_2023_state_percentile",
"GEOID",
"NAME",
"TOTAL_POPULATION",
"NH_WHITE_ALONE",
"NH_BLACK_ALONE",
"NH_AMERICAN_INDIAN_ALONE",
"NH_ASIAN_ALONE",
"NH_PACIFIC_ISLANDER_ALONE",
"NH_SOME_OTHER_RACE",
"NH_TWO_OR_MORE",
"NH_TWO_OR_MORE_INCLUDING_SOME_OTHER",
"NH_TWO_OR_MORE_EXCLUDING_SOME_OTHER",
"HISPANIC_OR_LATINO",
"PCT NH WHITE",
"PCT_NH_BLACK",
"PCT_NH_AMERICAN_INDIAN",
"PCT_NH_ASIAN",
"PCT_NH_PACIFIC_ISLANDER",
"PCT_NH_SOME_OTHER",
"PCT_NH_TWO_OR_MORE",
"PCT_NH_TWO_OR_MORE_INCLUDING_SOME_OTHER",
"PCT_NH_TWO_OR_MORE_EXCLUDING_SOME_OTHER",
"PCT_HISPANIC_OR_LATINO",
"WITH_A_DISABILITY_TOTAL",
"PCT_WITH_A_DISABILITY",
"PCT_SNAP_ASSISTANCE",
"MEDIAN_AGE",
"POVERTY_RATE",
"MEDIAN_HOUSEHOLD_INCOME",
"NO_HEALTHCARE_TOTAL",
"PCT_NO_HEALTHCARE",
"ADI_NATRANK",
"ADI_STATERNK",
"UNIT",
"UNIT_PLURAL",
] as const

// // const operators = ["=", "!=", ">", "<", ">=", "<=", "BETWEEN", "IN", "NOT IN", "LIKE", "NOT LIKE"]
// // const outputs = ["TABLE", "TIME_SERIES", "SCATTER", "HISTOGRAM"] as const
Expand Down
20 changes: 10 additions & 10 deletions app/posts/[post]/Client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
import { useTina } from "tinacms/dist/react"
import { PostRenderer } from "./Renderer"

export const PostClient: React.FC<{content: any}> = ({content}) => {
const data = useTina({
// @ts-ignore
query: content.query,
// @ts-ignore
variables: content.variables,
data: content.data
})
return <PostRenderer content={data} />
}
export const PostClient: React.FC<{ content: any }> = ({ content }) => {
const data = useTina({
// @ts-ignore
query: content.query,
// @ts-ignore
variables: content.variables,
data: content.data,
})
return <PostRenderer content={data} />
}
8 changes: 4 additions & 4 deletions app/posts/[post]/Post.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import IS_DEV from "utils/isDev";
import { PostClient } from "./Client";
import { PostRenderer } from "./Renderer";
import IS_DEV from "utils/isDev"
import { PostClient } from "./Client"
import { PostRenderer } from "./Renderer"

export const Post = IS_DEV ? PostClient : PostRenderer;
export const Post = IS_DEV ? PostClient : PostRenderer
4 changes: 2 additions & 2 deletions app/posts/[post]/Renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Image from "next/image"
import React from "react"
import { PostMarkdown } from "components/EnhancedMarkdown"

export const PostRenderer: React.FC<{content: any}> = ({content}) => {
export const PostRenderer: React.FC<{ content: any }> = ({ content }) => {
const { author, title, body, mainImage, date } = content?.data?.post || ({} as any)
const cleanDate = date && new Date(date).toLocaleDateString()
if (content instanceof Error)
Expand All @@ -28,4 +28,4 @@ export const PostRenderer: React.FC<{content: any}> = ({content}) => {
<PostMarkdown content={body} />
</div>
)
}
}
4 changes: 2 additions & 2 deletions components/EnhancedMarkdown/Tooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use client"
import Tooltip from "components/Tooltip"
import { useState } from "react"
import { useClientMdxContent } from "hooks/useClientMdxContent"
import { TinaMarkdown } from "tinacms/dist/rich-text"
import Tooltip from "components/Tooltip"
import { useClientMdxContent } from "hooks/useClientMdxContent"

export const MdTooltip: React.FC<{ tooltipKey?: string; body?: any }> = ({ tooltipKey, body }) => {
const [open, setOpen] = useState(false)
Expand Down
12 changes: 6 additions & 6 deletions components/EnhancedMarkdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import PostWidget from "components/PostWidgets"
import { MdTooltip } from "./Tooltip"

const DEFAULT_MARKDOWN_COMPONENTS = {
Tooltip: MdTooltip
Tooltip: MdTooltip,
}

export const PostMarkdown: React.FC<{content: any}> = ({content}) => {
return <EnhancedMarkdown components={{PostWidget}} content={content} />
export const PostMarkdown: React.FC<{ content: any }> = ({ content }) => {
return <EnhancedMarkdown components={{ PostWidget }} content={content} />
}

export const EnhancedMarkdown: React.FC<{content: any, components?: any}> = ({content, components = {}}) => {
return <TinaMarkdown components={{...DEFAULT_MARKDOWN_COMPONENTS, ...components}} content={content} />
}
export const EnhancedMarkdown: React.FC<{ content: any; components?: any }> = ({ content, components = {} }) => {
return <TinaMarkdown components={{ ...DEFAULT_MARKDOWN_COMPONENTS, ...components }} content={content} />
}
4 changes: 2 additions & 2 deletions components/Map/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import React, { useEffect, useRef, useState } from "react"
import GlMap, { FullscreenControl, NavigationControl, ScaleControl } from "react-map-gl"
import { Provider } from "react-redux"
import { useDebouncedCallback } from "use-debounce"
import { MemoryMonitor } from "components/dev/MemoryMonitor"
// import { MemoryMonitor } from "components/dev/MemoryMonitor"
import Legend from "components/Legend"
import { MapSettings } from "components/MapSettings/MapSettings"
import MapTooltip from "components/MapTooltip"
Expand Down Expand Up @@ -408,7 +408,7 @@ export const Map: React.FC<MapProps> = ({ initialFilter, simpleMap = false, onCl
</div>
</div>
<MapTooltip simpleMap={simpleMap} />
<MemoryMonitor />
{/* <MemoryMonitor /> */}
</div>
)
}
12 changes: 4 additions & 8 deletions components/MapSettings/MapSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"use client"
import React, { useMemo, useState } from "react"
import { TinaMarkdown } from "tinacms/dist/rich-text"
import CountyFilterSelector from "components/CountyFilterSelector"
import { MapInfoSection } from "components/MapInfoSection/MapInfoSection"
import { StatefulHighlightColorPicker } from "components/StatefulControls/StatefulHighlightColorPicker"
Expand All @@ -12,8 +13,6 @@ import { fetchCentroidById } from "utils/state/thunks"
import { MenuButton } from "./MapMenuButton"
import { MenuSection } from "./MapMenuSection"
import { Icons, MapSettingsIcon } from "./MapSettingsIcon"
import { MdTooltip } from "components/EnhancedMarkdown/Tooltip"
import { TinaMarkdown } from "tinacms/dist/rich-text"

const SettingsConfig: Array<{ label: string; icon: keyof typeof Icons }> = [
// {
Expand All @@ -37,9 +36,7 @@ const SettingsConfig: Array<{ label: string; icon: keyof typeof Icons }> = [
// icon: "Layers"
// }
]
const contentSectionTitles = [
'topics'
]
const contentSectionTitles = ["topics"]
const findContentSections = (contentSections: any[], titles: string[] = contentSectionTitles) => {
const entries: Record<string, React.ReactNode> = {}
for (const title of titles) {
Expand All @@ -49,7 +46,7 @@ const findContentSections = (contentSections: any[], titles: string[] = contentS
return entries
}

export const MapSettings: React.FC<{contentSections: any[]}> = ({contentSections}) => {
export const MapSettings: React.FC<{ contentSections: any[] }> = ({ contentSections }) => {
const sections = useMemo(() => findContentSections(contentSections), [contentSections])
const [activeMenuSection, setActiveMenuSection] = useState<string | undefined>(undefined)

Expand All @@ -70,7 +67,6 @@ export const MapSettings: React.FC<{contentSections: any[]}> = ({contentSections
const handleMenuButton = (label: string) => {
setActiveMenuSection((prev) => (prev === label ? undefined : label))
}


return (
<>
Expand Down Expand Up @@ -114,7 +110,7 @@ export const MapSettings: React.FC<{contentSections: any[]}> = ({contentSections
</button>
)}
<MenuSection title="Topics" isActive={activeMenuSection === "Map Layers"}>
{sections['topics']}
{sections["topics"]}
{Object.keys(columnGroups).map((group, i) => (
<MenuButton
key={i}
Expand Down
4 changes: 1 addition & 3 deletions components/Pages/Map/Renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import React from "react"
// lazy load the map
const Map = dynamic(() => import("components/Map/Map"), { ssr: false })

export const Renderer: React.FC<{contentSections: any}> = ({
contentSections
}) => {
export const Renderer: React.FC<{ contentSections: any }> = ({ contentSections }) => {
return (
<>
<Map contentSections={contentSections} />
Expand Down
2 changes: 1 addition & 1 deletion components/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function Tooltip({
side = "top",
className,
withArrow,
children
children,
}: TooltipProps) {
return (
<RadixTooltip.Provider>
Expand Down
2 changes: 1 addition & 1 deletion hooks/useClientMdxContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const useClientMdxContent = <T extends any>(
// console.log('matter', _matter)
// // dynamic import parseRich and parseRichRecursive
// _parseRich = await import("../utils/mdx/parseRich")
// _parseRichRecursive = await import("../utils/mdx/parseRichRecursive")
// _parseRichRecursive = await import("../utils/mdx/parseRichRecursive")

// }
// if (!ready && !_matter && !_parseRich && !_parseRichRecursive) {
Expand Down
6 changes: 3 additions & 3 deletions hooks/useMdxContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import matter from "gray-matter"
import { getContentDirs } from "utils/contentDirs"
import { collections } from "tina/collections/collections"
import IS_DEV from "utils/isDev"
import { parseRich, parseRichRecursive } from "utils/mdx/parseRich"

import parseRich from "utils/mdx/parseRich"
import parseRichRecursive from "utils/mdx/parseRichRecursive"

const parseCache: any = {}

Expand All @@ -33,7 +33,7 @@ export const getMdxContent = async <T extends any>(contentType: keyof typeof cli
},
}
// @ts-ignore
parseRichRecursive(parseCache[filepath][contentType], schema)
parseRichRecursive(parseCache[filepath][contentType], schema)
}
return {
data: parseCache[filepath] as T,
Expand Down
9 changes: 4 additions & 5 deletions tina/__generated__/client.d.ts

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

8 changes: 4 additions & 4 deletions tina/__generated__/client.js

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

Loading

0 comments on commit d7493ea

Please sign in to comment.