Skip to content

Commit

Permalink
Remove outdated code
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Fusco <[email protected]>
  • Loading branch information
josephfusco committed Oct 11, 2023
1 parent 07a4c5a commit 27ad111
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 433 deletions.
127 changes: 0 additions & 127 deletions components/HomepageLayoutsLayoutsFaqs.jsx
Original file line number Diff line number Diff line change
@@ -1,131 +1,5 @@
import { Container } from '@/components/Container'
import { gql } from '@apollo/client'
import Link from 'next/link'

// const faqs = [
// [
// {
// question: 'Can I use ACF Free or Pro with WPGraphQL for ACF?',
// answer:
// 'Yes! WPGraphQL for ACF works great with ACF Free and Pro. The Pro version of ACF has some additional features, such as Flexible Content Fields, Repeater Fields and Options Pages that are supported by WPGraphQL for ACF.',
// },
// {
// question: 'How much does WPGraphQL for ACF cost?',
// answer: 'WPGraphQL for ACF is a FREE open-source plugin. The development is sponsored by WPEngine.',
// },
// {
// question: 'Does this work with ACF Extended?',
// answer:
// 'Yes! WPGraphQL for ACF allows you to query for (most) fields created with ACF Extended.',
// },
// {
// question: 'Do I have to use Faust.js to use WPGraphQL for ACF?',
// answer:
// 'No! While this site is built using Fuast.js and Next.js, you can use WPGraphQL for ACF with any GraphQL client, including <a href="https://www.apollographql.com/docs/react/" target="_blank" rel="nofollow">Apollo</a>, <a href="https://relay.dev/" target="_blank" rel="nofollow">Relay</a>, <a href="https://formidable.com/open-source/urql/" target="_blank" rel="nofollow">Urql</a>, etc.',
// },
// ],
// [
// {
// question: 'Does WPGraphQL for ACF support GraphQL Mutations?',
// answer:
// 'GraphQL Mutations are not yet supported. We are working on adding support for Mutations in the future. We are waiting for the GraphQL "@oneOf" directive to be merged into the GraphQL spec before we add support for Mutations.',
// },
// {
// question:
// 'Can I filter and sort queries by ACF Fields using WPGraphQL for ACF?',
// answer:
// 'At this time WPGraphQL for ACF does not support filtering or sorting queries by ACF Fields. "Meta Queries" are often very expensive to execute, so we currently do not support filtering by ACF fields out of the box, but are exploring options for supporting it without the performance penalty.',
// },
// {
// question:
// 'I have an ACF Extension that adds a new field type, will it work with WPGraphQL for ACF?',
// answer:
// 'WPGraphQL for ACF supports the field types that come with ACF (Free and PRO) as well as the field typs in ACF Extended (Free and PRO). Support for additional field types can be added by using the "register_graphql_acf_field_type" API.',
// },
// ],
// [
// {
// question: 'Does this work with Field Groups registered in PHP or JSON?',
// answer:
// 'Yes! You can register ACF Field Groups and Fields using the Admin UI, PHP or JSON. WPGraphQL for ACF will detect the Field Groups and Fields and add them to the GraphQL Schema. If using PHP or JSON, you will need to set the "show_in_graphql" setting to "true" to expose the Field Group and Fields to the GraphQL Schema. There might be other settings that need attention at the field group or field level that might impact the schema or field resolution.',
// },
// {
// question: 'I think I found a bug, where do I report it?',
// answer: `If you think you found a bug, please <a href="https://github.com/wp-graphql/wpgraphql-acf/issues/new/choose" target="_blank" rel="nofollow">open an issue on GitHub</a>. The more details you provide in the issue, and the more clear your steps to reproduce are, the higher chances we will be able to help.`,
// },
// {
// question: 'Do I need WPGraphQL and ACF to be active to use this?',
// answer:
// 'This plugin is a "bridge" plugin that brings functionality of ACF to WPGraphQL. Both WPGraphQL and ACF need to be installed and active in your WordPress installation for this plugin to work.',
// },
// ],
// ]

function findSplit(arr, n)
{
var i;

// variable to store prefix sum
var preSum = 0;

// variables to store indices which
// have prefix sum divisible by S/3.
var ind1 = -1, ind2 = -1;

// variable to store sum of
// entire array.
var S;

// Find entire sum of the array.
S = arr[0];
for (i = 1; i < n; i++)
S += arr[i];

// Check if array can be split in
// three equal sum sets or not.
if(S % 3 != 0)
return 0;

// Variables to store sum S/3
// and 2*(S/3).
var S1 = S / 3;
var S2 = 2 * S1;

// Loop until second last index
// as S2 should not be at the last
for (i = 0; i < n-1; i++)
{
preSum += arr[i];

// If prefix sum is equal to S/3
// store current index.
if (preSum == S1 && ind1 == -1)
ind1 = i;

// If prefix sum is equal to 2* (S/3)
// store current index.
else if(preSum == S2 && ind1 != -1)
{
ind2 = i;

// Come out of the loop as both the
// required indices are found.
break;
}
}

// If both the indices are found
// then print them.
if (ind1 != -1 && ind2 != -1)
{
document.write( "(" + ind1 + ", "
+ ind2 + ")");
return 1;
}

// If indices are not found return 0.
return 0;
}

const getColumns = (questions, numberOfColumns) => {

Expand All @@ -146,7 +20,6 @@ const getColumns = (questions, numberOfColumns) => {
return columns;
};


const HomepageLayoutsLayoutsFaqs = ({ title, description, questions }) => {

const columns = getColumns(questions, 3);
Expand Down
59 changes: 2 additions & 57 deletions components/Layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@ import { useCallback, useEffect, useState } from 'react'
import Link from 'next/link'
import clsx from 'clsx'

import { Logo } from '@/components/Logo'
import { MobileNavigation } from '@/components/MobileNavigation'
import { SidebarNavigation, SidebarNavigationFragment } from '@/components/SidebarNavigation'
import { Prose } from '@/components/Prose'
import { Search } from '@/components/Search'
import { ThemeSelector } from '@/components/ThemeSelector'
import { gql } from '@apollo/client'
import { flatListToHierarchical } from '@faustwp/core'
import { collectHeadings } from '@/lib/utils'
import { WordPressIcon } from '@/components/icons/WordPressIcon'
import { GitHubIcon } from '@/components/icons/GitHubIcon'
import { SiteHeader } from '@/components/SiteHeader'

export const LayoutFragment = gql`
fragment LayoutFragment on RootQuery {
Expand All @@ -21,53 +16,6 @@ export const LayoutFragment = gql`
${SidebarNavigationFragment}
`

function Header({ navigation }) {
let [isScrolled, setIsScrolled] = useState(false)

useEffect(() => {
function onScroll() {
setIsScrolled(window.scrollY > 0)
}
onScroll()
window.addEventListener('scroll', onScroll, { passive: true })
return () => {
window.removeEventListener('scroll', onScroll)
}
}, [])

return (
<header
className={clsx(
'sticky top-0 z-50 flex flex-wrap items-center justify-between bg-white px-4 py-5 shadow-md shadow-slate-900/5 transition duration-500 dark:shadow-none sm:px-6 lg:px-8',
isScrolled
? 'dark:bg-slate-900/95 dark:backdrop-blur dark:[@supports(backdrop-filter:blur(0))]:bg-slate-900/75'
: 'dark:bg-transparent'
)}
>
<div className="mr-6 flex lg:hidden">
<MobileNavigation navigation={navigation} />
</div>
<div className="relative flex flex-grow basis-0 items-center">
<Link href="/" aria-label="Home page">
<Logo className="h-5 lg:h-9 w-auto bg-slate-900/95 p-1 rounded-md fill-slate-700 dark:fill-sky-100 lg:block" />
</Link>
</div>
<div className="-my-5 mr-6 sm:mr-8 md:mr-0">
<Search />
</div>
<div className="relative flex basis-0 justify-end gap-4 sm:gap-8 md:flex-grow">
<ThemeSelector className="relative z-10" />
<Link href="https://github.com/wp-graphql/wpgraphql-acf" className="group" aria-label="GitHub">
<GitHubIcon className="h-6 w-6 fill-slate-400 group-hover:fill-slate-500 dark:group-hover:fill-slate-300" />
</Link>
<Link href="https://github.com/wp-graphql/wpgraphql-acf" className="group" aria-label="GitHub">
<WordPressIcon className="h-6 w-6 fill-slate-400 group-hover:fill-slate-500 dark:group-hover:fill-slate-300" />
</Link>
</div>
</header>
)
}

function useTableOfContents(tableOfContents) {
let [currentSection, setCurrentSection] = useState(tableOfContents?.[0]?.id)

Expand Down Expand Up @@ -129,7 +77,6 @@ export function Layout({ data, children, toc, title }) {
childrenKey: 'links',
parentKey: 'parentId'
} ) : [];
let isHomePage = data?.node?.uri === '/'
let allLinks = navigation?.flatMap((section) => section.links) ?? []
let linkIndex = allLinks.findIndex((link) => {
return link.href === data?.node?.uri
Expand All @@ -143,8 +90,6 @@ export function Layout({ data, children, toc, title }) {
)
let currentSection = useTableOfContents(tableOfContents)



function isActive(section) {
if (section.id === currentSection) {
return true
Expand All @@ -157,7 +102,7 @@ export function Layout({ data, children, toc, title }) {

return (
<>
<Header navigation={navigation} />
<SiteHeader navigation={navigation} />

<div className="relative mx-auto flex max-w-8xl justify-center sm:px-2 lg:px-8 xl:px-12">
<div className="hidden lg:relative lg:block lg:flex-none">
Expand Down
Loading

0 comments on commit 27ad111

Please sign in to comment.