Skip to content

Commit 1d694de

Browse files
author
Dan Costello
committed
Glossary component
1 parent 1b96ddb commit 1d694de

10 files changed

Lines changed: 35 additions & 42 deletions

File tree

app/components/Glossary.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client';
2+
13
import React from 'react';
24
import Popover from './Popover';
35
import { glossaryDefinitions } from './glossary-definitions';
@@ -8,11 +10,10 @@ type GlossaryProps = {
810

911
const Glossary = ({ children }: GlossaryProps) => {
1012
const term = children.trim();
11-
console.log(term);
1213
const definition = glossaryDefinitions[term] || 'No definition found.';
1314
return (
1415
<Popover content={definition}>
15-
<span style={{ textDecoration: 'underline dotted', cursor: 'help' }}>{term}</span>
16+
<span style={{ textDecoration: 'underline dotted', cursor: 'help' }} className={definition ? '' : 'border border-red-500'}>{term}</span>
1617
</Popover>
1718
);
1819
};

app/docs/[[...slug]]/page.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export default async function Page(props: {
3030
<DocsBody className="prose dark:prose-invert">
3131
<MDXContent
3232
components={getMDXComponents({
33-
// this allows you to link to other pages with relative file paths
3433
a: createRelativeLink(source, page),
3534
})}
3635
/>

content/docs/(data-access)/definitions/access-policies.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ Access Policies control the circumstances under which data can be retrieved or e
1212

1313
Access Policies are executed in three places in UserClouds:
1414

15-
- Every <glossary>accessor</glossary> (read path) is associated with an access policy that controls access for each target user record and filters the records in the response accordingly.
16-
- Every <glossary>mutator</glossary> (write path) is associated with an access policy that governs whether the write is allowed.
17-
- Every <glossary>token</glossary> is associated with an access policy that governs the circumstances in which the token can be exchanged for the original data ("resolved").
15+
- Every <Glossary>accessor</Glossary> (read path) is associated with an access policy that controls access for each target user record and filters the records in the response accordingly.
16+
- Every <Glossary>mutator</Glossary> (write path) is associated with an access policy that governs whether the write is allowed.
17+
- Every <Glossary>token</Glossary> is associated with an access policy that governs the circumstances in which the token can be exchanged for the original data ("resolved").
1818

1919
In addition, two special types of access policies are available:
2020

content/docs/(data-access)/definitions/mutators-write-apis.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ updatedAt: "Tue Sep 10 2024 16:09:35 GMT+0000 (Coordinated Universal Time)"
88
---
99
## Introduction
1010

11-
Mutators are configurable APIs that allow a client to write data to the User Store. Mutators (setters) can be thought of as the complement to <<glossary:accessor>>s (getters). Mutators serve two functions:
11+
Mutators are configurable APIs that allow a client to write data to the User Store. Mutators (setters) can be thought of as the complement to <glossary:accessor>s (getters). Mutators serve two functions:
1212

1313
- Storing sensitive user data in the store
1414
- Storing user <<glossary:consent>>s to data processing <<glossary:purpose>>s alongside that data

content/docs/(data-access)/definitions/selectors.md renamed to content/docs/(data-access)/definitions/selectors.mdx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ updatedAt: "Fri Mar 01 2024 17:20:02 GMT+0000 (Coordinated Universal Time)"
88
---
99
# Introduction
1010

11-
Selectors are SQL-like clauses that specify which records an <<glossary:accessor>> or <<glossary:mutator>> should act on. Each accessor/mutator is associated with exactly one selector. The selector is specified at accessor/mutator creation time, either as a free text input in the UI, or as a string through the API.
11+
Selectors are SQL-like clauses that specify which records an <Glossary>accessor</Glossary> or <Glossary>mutator</Glossary> should act on. Each accessor/mutator is associated with exactly one selector. The selector is specified at accessor/mutator creation time, either as a free text input in the UI, or as a string through the API.
1212

13-
A Selector may refer to configured Columns, specified as `{ColumnName}`, where ColumnName is the defined name of the Column. Note that non-<<glossary:system column>>s used in selectors are subject to <<glossary:purpose check>>s: each accessor's response will filter out users who have not consented to the accessor's purpose for all columns being retrieved, and all non-system columns used in the selector.
13+
A Selector may refer to configured Columns, specified as `{ColumnName}`, where ColumnName is the defined name of the Column. Note that non-<Glossary>system column</Glossary>s used in selectors are subject to <Glossary>purpose check</Glossary>s: each accessor's response will filter out users who have not consented to the accessor's purpose for all columns being retrieved, and all non-system columns used in the selector.
1414

15-
A Selector may also specify a collection of variables, each of which is represented by a `?`, allowing the Selector to be parameterized for each individual accessor or mutator invocation. The `SelectorValues` array that is specified when executing an Accessor or Mutator is used to parameterize the associated Selector. Each of the values in <<glossary:SelectorValues>> must be a concrete value (i.e., contain no variables), and the number of values in SelectorValues must exactly match the number of variables in the Selector. The variables in a Selector are replaced sequentially by the values in SelectorValues at invocation time - the first value in SelectorValues replaces the first variable in the Selector, and so on. The type of each value must match the expected type of the value placeholder.
15+
A Selector may also specify a collection of variables, each of which is represented by a `?`, allowing the Selector to be parameterized for each individual accessor or mutator invocation. The `SelectorValues` array that is specified when executing an Accessor or Mutator is used to parameterize the associated Selector. Each of the values in <Glossary>SelectorValues</Glossary> must be a concrete value (i.e., contain no variables), and the number of values in SelectorValues must exactly match the number of variables in the Selector. The variables in a Selector are replaced sequentially by the values in SelectorValues at invocation time - the first value in SelectorValues replaces the first variable in the Selector, and so on. The type of each value must match the expected type of the value placeholder.
1616

1717
Examples of selectors include:
1818

1919
- `{FirstName} LIKE ?`
20-
- `{Address}->>’country’ = ‘USA’`
20+
- `{Address}-</Glossary>’country’ = ‘USA’`
2121
- `{BoolColumn} = TRUE OR {IntColumn} = ?`
2222

2323
See below for a longer list of examples.
@@ -84,8 +84,8 @@ ARRAY_ELEMENTS must either be a VALUE or a comma-separated list of VALUEs. Each
8484

8585
### COLUMN_IDENTIFIERs
8686

87-
- {column_name} - The selector query will replace the column identifier with the column value for the specific column_name for a given user
88-
- {column_name}->>’field_name’ - If column_name refers to a column that has a data type of address or composite, a valid subfield specified by field_name can be referenced in the column identifier.
87+
- `{column_name}` - The selector query will replace the column identifier with the column value for the specific column_name for a given user
88+
- `{column_name}` - ’field_name’ - If column_name refers to a column that has a data type of address or composite, a valid subfield specified by field_name can be referenced in the column identifier.
8989

9090
### INT_VALUEs
9191

@@ -198,9 +198,9 @@ The following are all examples of valid selector queries:
198198
| `{IntColumn} = ANY ARRAY[3, 4::INT, ?]` | return users where the IntColumn value is either 3, 4, or the parameterized value |
199199
| `ABS(MOD({IntColumn},3)) = ?` | return users where the absolute value of IntColumn value mod 3 equals parameterized value |
200200
| `DIV({IntColumn}, ?) = ?` | return users where the quotient of dividing the IntColumn value by a parameterized value equals a second parameterized value |
201-
| `{AddressColumn}->>’country’ IS NULL` | return users where the country field of AddressColumn is not set |
202-
| `{AddressColumn}->>’country’ = ?` | return users where the country field of AddressColumn equals the parameterized value |
203-
| `{AddressColumn}->>’country’ = ‘USA’` | return users where the country field AddressColumn is ‘USA’ |
201+
| `{AddressColumn}-</Glossary>’country’ IS NULL` | return users where the country field of AddressColumn is not set |
202+
| `{AddressColumn}-</Glossary>’country’ = ?` | return users where the country field of AddressColumn equals the parameterized value |
203+
| `{AddressColumn}-</Glossary>’country’ = ‘USA’` | return users where the country field AddressColumn is ‘USA’ |
204204
| `{StringColumn} LIKE ?` | return users that have a StringColumn value that matches the parameterized pattern |
205205
| `{StringColumn} LIKE ‘%foo%’` | return users that have a StringColumn value that contains the string ‘foo’ |
206206
| `lower({StringColumn}) = ANY ARRAY[‘foo’,’bar’,’baz’]` | return users that have a StringColumn value that when lower-cased equals either ‘foo’, ‘bar’, or ‘baz’ |
File renamed without changes.

lib/source.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
import { docs, meta } from "@/.source";
1+
import { docs } from '@/.source';
22
import { loader } from 'fumadocs-core/source';
3-
import { createMDXSource } from "fumadocs-mdx";
43

5-
// See https://fumadocs.vercel.app/docs/headless/source-api for more info
64
export const source = loader({
7-
// it assigns a URL to your pages
85
baseUrl: '/docs',
9-
source: createMDXSource(docs, meta),
10-
});
6+
source: docs.toFumadocsSource(),
7+
});

mdx-components.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import defaultMdxComponents from 'fumadocs-ui/mdx';
22
import type { MDXComponents } from 'mdx/types';
33
import Glossary from './app/components/Glossary';
4+
45
// use this function to get MDX components, you will need it for rendering MDX
56
export function getMDXComponents(components?: MDXComponents): MDXComponents {
67
return {
78
...defaultMdxComponents,
8-
glossary: Glossary,
99
...components,
10+
Glossary
1011
};
1112
}

next.config.mjs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@ import { createMDX } from 'fumadocs-mdx/next';
22

33
const withMDX = createMDX();
44

5+
const isDev = process.env.NODE_ENV === 'development';
6+
57
/** @type {import('next').NextConfig} */
68
const config = {
79
reactStrictMode: true,
810
images: {
9-
domains: ['files.readme.io'],
11+
unoptimized: isDev,
12+
remotePatterns: [
13+
{
14+
hostname: 'files.readme.io',
15+
},
16+
],
1017
},
1118
};
1219

source.config.ts

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,11 @@
1-
import {
2-
defineConfig,
3-
defineDocs,
4-
frontmatterSchema,
5-
metaSchema,
6-
} from 'fumadocs-mdx/config';
1+
import { defineDocs } from 'fumadocs-mdx/config';
72

8-
// You can customise Zod schemas for frontmatter and `meta.json` here
9-
// see https://fumadocs.vercel.app/docs/mdx/collections#define-docs
10-
export const {docs, meta} = defineDocs({
3+
export const docs = defineDocs({
4+
dir: 'content/docs',
115
docs: {
12-
schema: frontmatterSchema,
6+
// options for `doc` collection
137
},
148
meta: {
15-
schema: metaSchema,
9+
// options for `meta` collection
1610
},
17-
});
18-
19-
export default defineConfig({
20-
mdxOptions: {
21-
// MDX options
22-
},
23-
});
11+
});

0 commit comments

Comments
 (0)