This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {useState} from 'react' | |
import {Box, Text, Container, Card, Stack, Flex} from '@sanity/ui' | |
import subDays from 'date-fns/subDays' | |
import {format} from 'date-fns' | |
import DateTimeInput from 'part:@sanity/form-builder' | |
export default function DateTimeDisplay() { | |
const [fromDate, setFromDate] = useState(subDays(new Date(), 1)) | |
const [toDate, setToDate] = useState(new Date()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import {Box, Card, Container, Text} from '@sanity/ui' | |
import {useCurrentUser} from './useCurrentUser' | |
export default function SuperSecretTool() { | |
const {roles} = useCurrentUser() | |
const isAdmin = roles?.length ? roles.find((role) => role?.name === 'administrator') : false | |
if (!isAdmin) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import {withDocument} from 'part:@sanity/form-builder' | |
import {Stack, Card, Flex, Text} from '@sanity/ui' | |
import {format} from 'date-fns' | |
const WORD_LENGTH = 5 | |
function Guess({char, answer, index}) { | |
const answerSplit = answer.split('') | |
let tone = `default` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import {Stack, Card, Flex, Switch, Label, Box, Text, Autocomplete, Button} from '@sanity/ui' | |
import {AddIcon, TrashIcon} from '@sanity/icons' | |
import {daysOfTheWeek, hoursOfTheDay} from './data' | |
export default function TradingHours() { | |
// Update how trading times are searched for | |
const handleAutocompleteFilter = (query, option) => { | |
// Treat a search for 1.00 as 1:00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import PropTypes from 'prop-types' | |
import {withDocument} from 'part:@sanity/form-builder' | |
import {Stack, Card, Box, Text, Flex} from '@sanity/ui' | |
import {FiGitBranch, FiGitCommit, FiZap, FiAlertOctagon, FiFileText, FiFile} from 'react-icons/fi' | |
import DEFAULT_VARIANT from '../../lib/defaultVariant' | |
const Message = React.forwardRef(({document}, ref) => { | |
const {_id, variant, live, _createdAt} = document |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {useState, useMemo, useEffect} from 'react' | |
import {useDocumentOperation} from '@sanity/react-hooks' | |
import {FiZap, FiZapOff} from 'react-icons/fi' | |
export function ToggleLive({id, type, draft, published, onComplete}) { | |
const {patch, publish} = useDocumentOperation(id, type) | |
const doc = useMemo(() => draft || published, [draft, published]) | |
const [isPublishing, setIsPublishing] = useState(false) | |
const [dialogOpen, setDialogOpen] = useState(false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is all explained in a complete guide at: | |
// https://www.sanity.io/guides/parent-child-taxonomy | |
import S from '@sanity/desk-tool/structure-builder' | |
import documentStore from 'part:@sanity/base/datastore/document' | |
import {map} from 'rxjs/operators' | |
import {FiTag} from 'react-icons/fi' | |
/** | |
* This is an example of a Structure Builder list item that: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import S from '@sanity/desk-tool/structure-builder' | |
import schema from 'part:@sanity/base/schema' | |
import userStore from 'part:@sanity/base/user' | |
// npm i pluralize | |
import pluralize from 'pluralize' | |
// BYO "Flag" component for an Icon | |
// import Flag from '../components/Flag/index' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sanityClient = require('@sanity/client') | |
const fs = require('fs') | |
const client = sanityClient({ | |
apiVersion: '2021-04-01', | |
dataset: `XXX`, | |
projectId: `XXX`, | |
useCdn: true, | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable react/prop-types */ | |
/* eslint-disable react/jsx-no-bind */ | |
import React, {useState, useCallback, useMemo} from 'react' | |
import {SearchIcon, ArrowRightIcon} from '@sanity/icons' | |
import {useToast, Text, Flex, Box, Button, Autocomplete, Label, Stack} from '@sanity/ui' | |
import sanityClient from 'part:@sanity/base/client' | |
export const MARKETS = [ | |
{ | |
name: `DE`, |