Skip to content

Commit

Permalink
Merge branch 'main' into tina/reference-field-custom-filter-api
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben0189 authored Sep 20, 2024
2 parents 939a3e1 + b66adea commit 3c752a8
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 34 deletions.
9 changes: 1 addition & 8 deletions components/blocks/LogoGrid.template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,7 @@ export const logoGridTemplate: TinaTemplate = {
name: 'link',
label: 'Link',
type: 'string',
ui: {
validate: (val) => {
// make sure value is https url
if (!val?.startsWith('https://')) {
return 'Must be a valid https url'
}
},
},
description: 'The URL to link to when the logo is clicked. Should be either (1) an internal link (e.g. /showcase#unity) or (2) an external link (e.g. https://ndcconferences.com/).',
},
{ name: 'logo', label: 'Logo Image', type: 'image' },
{ name: 'size', label: 'Size', type: 'number' },
Expand Down
28 changes: 14 additions & 14 deletions content/blocksPages/home.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,49 +39,49 @@
"items": [
{
"name": "Bunny Net",
"link": "https://tina.io/showcase#bunny-net",
"link": "/showcase#bunny-net",
"logo": "/svg/logos/bunnynet.svg",
"size": 220
},
{
"name": "Unity",
"link": "https://tina.io/showcase#unity",
"link": "/showcase#unity",
"logo": "/svg/logos/unity.svg",
"size": 220
},
{
"name": "Protocol Labs",
"link": "https://tina.io/showcase#protocol-labs",
"link": "/showcase#protocol-labs",
"logo": "/svg/logos/protocollabs.svg",
"size": 90
},
{
"name": "City of London",
"link": "https://tina.io/showcase#city-of-london",
"link": "/showcase#city-of-london",
"logo": "/svg/logos/cityoflondon.svg",
"size": 120
},
{
"name": "Devolver Digital",
"link": "https://tina.io/showcase#devolver-digital",
"link": "/showcase#devolver-digital",
"logo": "/svg/logos/devolverdigital.svg",
"size": 150
},
{
"name": "Smashing Magazine",
"link": "https://tina.io/showcase#smashing-magazine",
"link": "/showcase#smashing-magazine",
"logo": "/svg/logos/smashing.svg",
"size": 90
},
{
"name": "Supernova",
"link": "https://tina.io/showcase#supernova",
"link": "/showcase#supernova",
"logo": "/svg/logos/supernova.svg",
"size": 240
},
{
"name": "Paradise Helicopters",
"link": "https://tina.io/showcase#paradise-helicopters",
"link": "/showcase#paradise-helicopters",
"logo": "/svg/logos/paradisehelicopters.svg",
"size": 150
},
Expand All @@ -93,37 +93,37 @@
},
{
"name": "SSW",
"link": "https://tina.io/showcase#ssw",
"link": "/showcase#ssw",
"logo": "/svg/logos/ssw-logo-charcoal.svg",
"size": 150
},
{
"name": "Comedia",
"link": "https://tina.io/showcase#comedia",
"link": "/showcase#comedia",
"logo": "/svg/logos/comedia.svg",
"size": 110
},
{
"name": "RRE Ventures",
"link": "https://tina.io/showcase#rre-ventures",
"link": "/showcase#rre-ventures",
"logo": "/svg/logos/rreventures.svg",
"size": 220
},
{
"name": "Shadow Lion",
"link": "https://tina.io/showcase#shadow-lion",
"link": "/showcase#shadow-lion",
"logo": "/svg/logos/shadowlion.svg",
"size": 220
},
{
"name": "Roev",
"link": "https://tina.io/showcase#roev",
"link": "/showcase#roev",
"logo": "/svg/logos/roe.svg",
"size": 200
},
{
"name": "Locality Bank",
"link": "https://tina.io/showcase#locality-bank",
"link": "/showcase#locality-bank",
"logo": "/svg/logos/localitybank.svg",
"size": 200
}
Expand Down
4 changes: 0 additions & 4 deletions content/docs/editing/blocks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,7 @@ The fragment names are automatically generated based on the collection name and
####}
##}
}"
<<<<<<< HEAD
preselectResponse={false}
=======
preselectResponse={true}
>>>>>>> de5f2c35126ddcbc14a0d8442990981632405a42
/>

> For more info on how to query data with Tina's GraphQL API, check out the [Query Documentation](https://tina.io/docs/graphql/queries/)
Expand Down
1 change: 1 addition & 0 deletions pages/api/feedback.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//TODO – this is no longer needed, https://github.com/tinacms/tina.io/issues/2215
import Airtable from 'airtable'

interface FeedbackRecord {
Expand Down
3 changes: 2 additions & 1 deletion pages/api/graphql.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as gqlPackage from '@tinacms/graphql-old'
//TODO – check if this is still needed, the graphiql playgrounds have already been replaced, see https://github.com/tinacms/tina.io/issues/2001
import * as datalayerPackage from '@tinacms/datalayer-old'
import * as gqlPackage from '@tinacms/graphql-old'

export default async function feedback(req, res) {
class InMemoryStore extends datalayerPackage.LevelStore {
Expand Down
2 changes: 1 addition & 1 deletion tina/tina-lock.json

Large diffs are not rendered by default.

26 changes: 20 additions & 6 deletions utils/toc_helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,37 @@ export function createTocListener(
setActiveIds: (activeIds: string[]) => void
): () => void {
let tick = false
const BASE_OFFSET = 16
const THROTTLE_INTERVAL = 100
const headings = createHeadings(contentRef)
//Find the maximum pixel value from vertical scroll
const maxScrollY = document.documentElement.scrollHeight - window.innerHeight;

const relativePositionHeadingMap = headings.map((heading) => {
return {
...heading,
//Find the relative position of the heading based on the page content.
relativePagePosition: (heading.offset / contentRef.current.scrollHeight),
}
});

const throttledScroll = () => {
//Find the current vertical scroll pixel value
const scrollPos = window.scrollY
const newActiveIds = []
const activeHeadingCandidates = headings.filter((heading) => {
return heading.offset - scrollPos < BASE_OFFSET
//Find the relative position on the page based on the scroll.
const relativeScrollPosition = scrollPos / maxScrollY
//Find the headings that are above the current scroll position
//This is adjusted to account for differences between min/max scroll values and content height
const activeHeadingCandidates = relativePositionHeadingMap.filter((heading) => {
return relativeScrollPosition >= heading.relativePagePosition
})

const activeHeading =
activeHeadingCandidates.length > 0
? activeHeadingCandidates.reduce((prev, current) =>
prev.offset > current.offset ? prev : current
)
: {}
: headings[0] ?? {}
newActiveIds.push(activeHeading.id)

if (activeHeading.level != 'H2') {
Expand All @@ -60,9 +74,9 @@ export function createTocListener(
? activeHeadingParentCandidates.reduce((prev, current) =>
prev.offset > current.offset ? prev : current
)
: {}
: null

if (activeHeadingParent.id) {
if (activeHeadingParent?.id) {
newActiveIds.push(activeHeadingParent.id)
}
}
Expand Down

0 comments on commit 3c752a8

Please sign in to comment.