Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: massive docs rewrite #473

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
223 changes: 100 additions & 123 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,6 @@ export default defineConfig({
label: 'English',
lang: 'en',
},
es: {
label: 'Español',
lang: 'es',
},
fr: {
label: 'Français',
lang: 'fr',
},
},
components: {
Header: './src/components/docs/Header.astro',
Expand All @@ -64,180 +56,165 @@ export default defineConfig({
sidebar: [
{
label: 'Intro to Web Monetization',
link: '/docs/',
},
{
label: 'Support web monetized content',
collapsed: true,
items: [
{
label: 'Overview',
link: '/docs/',
link: '/support/overview',
},
{
label: 'Sending payments',
link: '/docs/intro/sending-payments',
label: 'Quick start guide',
link: '/support/quick-start',
},
{
label: 'Receiving payments',
link: '/docs/intro/receiving-payments',
label: 'Use the extension',
link: '/support/use-extension',
},
{
label: 'Web Monetization flow',
link: '/docs/intro/web-monetization-flow',
label: 'How payments work',
link: '/support/how-payments-work',
},
],
},
{
label: 'References',
label: 'Experiment with Web Monetization',
collapsed: true,
items: [
{
label: 'Web Monetization API',
label: 'Overview',
link: '/experiment/overview',
},
{
label: 'Quick start guide',
link: '/experiment/quick-start',
},
{
label: 'How payments work',
link: '/experiment/how-payments-work',
},
{
label: 'Developer corner',
collapsed: true,
items: [
{
label: 'HTML <link> rel=monetization',
link: '/docs/references/html-link-rel-monetization',
},
{
label: 'Monetization events',
label: 'Guides',
collapsed: true,
items: [
{
label: 'MonetizationEvent',
link: '/docs/references/monetizationevent',
label: 'Show content to paying visitors',
link: '/experiment/guides/show-content',
},
{
label: 'amountSent',
link: '/docs/references/attributes/amountsent',
label: 'Remove content for paying visitors',
link: '/experiment/guides/remove-content',
},
{
label: 'incomingPayment',
link: '/docs/references/attributes/incomingpayment',
label: 'Show visitors how much they\'ve contributed',
link: '/experiment/guides/contribution-counter',
},
{
label: 'paymentPointer',
link: '/docs/references/attributes/paymentpointer',
label: 'Set up probabilistic revenue sharing',
link: '/experiment/guides/revenue-sharing',
},
{
label: 'amount',
link: '/docs/references/attributes/amount',
badge: { text: 'deprecated', variant: 'danger' },
label: 'Test Web Monetization',
link: '/experiment/guides/test-web-monetization',
},
],
},
{
label: 'APIs',
collapsed: true,
items: [
{
label: 'HTML DOM API',
collapsed: false,
items: [
{
label: 'Monetization <link> element',
link: '/experiment/link-element',
},
{
label: 'onmonetization event handler',
link: '/experiment/onmonetization',
},
],
},
{
label: 'assetCode',
link: '/docs/references/attributes/assetcode',
badge: { text: 'deprecated', variant: 'danger' },
label: 'Web Monetization API',
collapsed: false,
items: [
{
label: 'Monetization interfaces',
link: '/experiment/wmapi-interfaces',
},
{
label: 'Monetization events',
link: '/experiment/events',
},
],
},
],
},
{
label: 'HTTP Headers',
collapsed: true,
items: [
{
label: 'assetScale',
link: '/docs/references/attributes/assetscale',
badge: { text: 'deprecated', variant: 'danger' },
label: 'Content Security Policy (CSP)',
link: '/experiment/csp',
},
{
label: 'receipt',
link: '/docs/references/attributes/receipt',
badge: { text: 'deprecated', variant: 'danger' },
label: 'Permissions Policy',
link: '/experiment/permissions-policy',
},
],
},
],
},
{
label: 'HTTP headers',
items: [
{
label: 'Content-Security-Policy: monetization-src',
link: '/docs/references/csp-monetization-src',
label: 'Libraries',
link: '/experiment/libraries',
},
{
label: 'Permissions-Policy: monetization',
link: '/docs/references/permissions-policy-monetization',
},
],
},
{
label: 'Events',
items: [
{
label: 'GlobalEventHandlers: onmonetization',
link: '/docs/references/onmonetization',
label: 'Web Monetization Specification',
link: 'https://webmonetization.org/specification/',
attrs: { target: '_blank' },
},
],
},
],
},
{
label: 'Guides',
collapsed: true,
items: [
{
label: 'Add Web Monetization to a page',
link: '/docs/guides/monetize-page',
},
{
label: 'Remove ads',
link: '/docs/guides/remove-ads',
},
{
label: 'Provide exclusive content',
link: '/docs/guides/provide-exclusive-content',
},
{
label: 'Set up probabilistic revenue sharing',
link: '/docs/guides/set-up-probabilistic-revenue-sharing',
},
{
label: 'Add a streaming payments counter',
link: '/docs/guides/add-a-streaming-payments-counter',
},
],
},
{
label: 'Resources',
collapsed: true,
items: [
{
label: 'Glossary',
link: '/docs/resources/glossary',
label: 'Compatible digital wallets',
link: '/resources/wallets',
},
{
label: 'Libraries',
link: '/docs/resources/libraries',
},
{
label: 'Web Monetization-enabled wallets',
link: '/docs/resources/op-wallets',
},
{
label: 'Get involved',
link: '/docs/resources/get-involved',
},
{
label: 'Interledger',
link: 'https://interledger.org/',
attrs: {
target: '_blank',
rel: 'noopener noreferrer',
'data-icon': 'external',
},
label: 'Glossary',
link: '/resources/glossary',
},
{
label: 'Open Payments API',
link: 'https://openpayments.guide/',
attrs: {
target: '_blank',
rel: 'noopener noreferrer',
'data-icon': 'external',
},
label: 'Community',
collapsed: true,
items: [
{
label: 'Get involved',
link: '/resources/community/get-involved',
},
{
label: 'Recommended web monetized sites',
link: '/resources/recommended-sites',
},
],
},
],
},
{
label: 'Specification',
link: 'https://webmonetization.org/specification/',
attrs: {
target: '_blank',
rel: 'noopener noreferrer',
'data-icon': 'external',
},
},
],
}),
react(),
Expand Down
1 change: 0 additions & 1 deletion public/img/docs/diagram-wm-flow.svg

This file was deleted.

Binary file removed public/img/docs/diagram-wm-overview.png
Binary file not shown.
Binary file removed public/img/docs/fynbos/fb-pp.png
Binary file not shown.
Binary file removed public/img/docs/gatehub/gh-add-funds.png
Binary file not shown.
Binary file removed public/img/docs/gatehub/gh-pp.png
Binary file not shown.
6 changes: 5 additions & 1 deletion src/components/docs/PageSidebar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import type { Props } from '@astrojs/starlight/props';
import Default from '@astrojs/starlight/components/PageSidebar.astro';

const removeOverview = [
'docs/resources/glossary',
'resources/glossary',
'resources/community/get-involved',
'experiment/quick-start',
'experiment/how-payments-work',
'support/how-payments-work',
]
const noOverview = removeOverview.includes(Astro.props.slug);
const toc = noOverview && Astro.props.toc !== undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@ export function ActiveView() {
<p className={styles.text}>
If you make any changes to the table, your monetization{' '}
<code>link</code> will change. Be sure to replace your old{' '}
<code>link</code> element with the updated version. Check out{' '}
<a href='/docs/guides/monetize-page' target='_blank'>
Add Web Monetization to a page
</a>{' '}
if you need help.
<code>link</code> element with the updated version.
</p>
<ImportView />
</>
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/ProbRevshare/components/_link-tag.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function SharesLinkTag() {
}

if (!pointer) {
return <p>Enter shares with valid payment pointers and weights.</p>
return <p>Enter shares with valid wallet addresses and/or payment pointers and weights.</p>
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function ShareInputContainer({ children }) {
<thead>
<tr>
<th>Name</th>
<th>Pointer</th>
<th>Wallet Address/Payment Pointer</th>
<th>Weight</th>
<th>Percent</th>
<th></th>
Expand Down
8 changes: 4 additions & 4 deletions src/components/pages/ProbRevshare/lib/_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,24 @@ export function pointerToShares(pointer) {

if (!encodedList) {
throw new Error(
'No share data found. Make sure you copy the whole "content" field from your meta tag.',
'No share data found. Make sure you copy the whole "content" field from your link tag.',
)
}

const pointerList = JSON.parse(fromBase64url(encodedList))

if (!validatePointerList(pointerList)) {
throw new Error(
'Share data is invalid. Make sure you copy the whole "content" from your meta tag.',
'Share data is invalid. Make sure you copy the whole "content" from your link tag.',
)
}
return sharesFromPointerList(pointerList)
} catch (err) {
if (err.name === 'TypeError') {
throw new Error('Meta tag or payment pointer is malformed')
throw new Error('Link tag, wallet address, or payment pointer is malformed')
} else if (err.name === 'SyntaxError') {
throw new Error(
'Payment pointer has malformed share data. Make sure to copy the entire pointer.',
'Wallet address or payment pointer has malformed share data. Make sure to copy the entire address.',
)
} else {
throw err
Expand Down
Loading
Loading