Skip to content

Commit

Permalink
Glitch Clean Up (#432)
Browse files Browse the repository at this point in the history
* Glitch Clean Up

* glitch-clean-up

Prettier applied

* Bump dependencies to latest version

* Remove unneccesary dependency

* Remove lock files

---------

Co-authored-by: Chen Hui Jing <1461498+huijing@users.noreply.github.com>
  • Loading branch information
hajjimo and huijing authored Feb 13, 2024
1 parent 0913168 commit 6a55c6d
Show file tree
Hide file tree
Showing 32 changed files with 8,965 additions and 3,357 deletions.
18 changes: 10 additions & 8 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ about: Let us know if you found any bugs on the website
title: ''
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
Expand All @@ -24,15 +24,17 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/get-contributors.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async function getContributors() {
headers: {
'X-GitHub-Api-Version': '2022-11-28',
},
}
},
)
const contributors = JSON.stringify(data)
fs.writeFileSync('src/data/contributors.json', contributors)
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ pnpm-debug.log*
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# lock file
bun.lockb
1 change: 0 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ tabWidth: 2
jsxSingleQuote: true
bracketSpacing: true
singleQuote: true

1 change: 0 additions & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ Contributions to Specifications are made under the

Contributions to Test Suites are made under the
[W3C 3-clause BSD License](https://www.w3.org/Consortium/Legal/2008/03-bsd-license.html)

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ For example, a copy of [version 1.0 of the specification](https://github.com/WIC

## Editing Content

Starlight looks for `.md` or `.mdx` files in the `src/content/docs/` directory. Each file is exposed as a route based on its file name.
Starlight looks for `.md` or `.mdx` files in the `src/content/docs/` directory. Each file is exposed as a route based on its file name.

### Double docs sub-folder

Expand Down
19 changes: 8 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,20 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/react": "^3.0.9",
"@astrojs/starlight": "^0.16.0",
"@astrojs/react": "^3.0.10",
"@astrojs/starlight": "^0.18.0",
"@interledger/docs-design-system": "^0.2.1",
"@types/react": "^18.2.48",
"@types/react-dom": "^18.2.18",
"astro": "4.2.4",
"@types/react": "^18.2.55",
"@types/react-dom": "^18.2.19",
"astro": "4.3.6",
"astro-i18next": "^1.0.0-beta.21",
"prettier": "^3.2.4",
"prettier": "^3.2.5",
"prism-react-renderer": "^2.3.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-minimal-pie-chart": "^8.4.0",
"remark-mermaidjs": "^6.0.0",
"respec": "^34.3.0",
"respec": "^34.4.0",
"sharp": "^0.33.2"
},
"devDependencies": {
"netlify-plugin-playwright-cache": "^0.0.1"
}
}
}
3 changes: 2 additions & 1 deletion src/components/pages/LinkTagGenerator/LinkTagGenerator.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ export default function LinkTagGenerator() {
<CodeBlock>{`<link rel="monetization" href="${pointer}" />`}</CodeBlock>

<p className={styles.text}>
After generating your <code>&lt;link&gt;</code> element, add the element to the <code>&lt;head&gt;</code> section of your website.
After generating your <code>&lt;link&gt;</code> element, add the element
to the <code>&lt;head&gt;</code> section of your website.
</p>

<p className={styles.text}>
Expand Down
12 changes: 10 additions & 2 deletions src/components/pages/ProbRevshare/components/_active-view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,18 @@ export function ActiveView() {
<>
<h2 className='heading3'>Import existing revshare configuration</h2>
<p className={styles.text}>
Enter your current monetization <code>link</code> element into the field and click <b>Import</b>. The table will populate with your existing revshare's configuration.
Enter your current monetization <code>link</code> element into the
field and click <b>Import</b>. The table will populate with your
existing revshare's configuration.
</p>
<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.
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.
</p>
<ImportView />
</>
Expand Down
4 changes: 1 addition & 3 deletions src/components/pages/ProbRevshare/components/_link-tag.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ export function SharesLinkTag() {
}

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

return (
Expand Down
4 changes: 2 additions & 2 deletions src/components/pages/ProbRevshare/components/_share-list.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ export function ShareList() {
setShares(
changeList(shares, i, {
weight: trimDecimal(
weightFromPercent(percent, share.weight, totalWeight)
weightFromPercent(percent, share.weight, totalWeight),
),
})
}),
)
}
onRemove={() => setShares(dropIndex(shares, i))}
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,15 +77,15 @@ 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 meta 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 meta tag.',
)
}
return sharesFromPointerList(pointerList)
Expand All @@ -94,7 +94,7 @@ export function pointerToShares(pointer) {
throw new Error('Meta tag 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.'
'Payment pointer has malformed share data. Make sure to copy the entire pointer.',
)
} else {
throw err
Expand All @@ -111,7 +111,7 @@ export function tagToShares(tag) {
if (!meta && !link) {
console.log(node, node.head)
throw new Error(
'Please enter the exact link element you generated from this revshare tool. It seems to be malformed.'
'Please enter the exact link element you generated from this revshare tool. It seems to be malformed.',
)
}

Expand Down
6 changes: 3 additions & 3 deletions src/content/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineCollection } from 'astro:content';
import { docsSchema, i18nSchema } from '@astrojs/starlight/schema';
import { defineCollection } from 'astro:content'
import { docsSchema, i18nSchema } from '@astrojs/starlight/schema'

export const collections = {
docs: defineCollection({ schema: docsSchema() }),
i18n: defineCollection({ type: 'data', schema: i18nSchema() }),
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The example below illustrates how to use the `monetization` event to show a web
```html
<head>
<!-- this should be set to your own wallet address -->
<link rel="monetization" href="https://wallet.example/alice" />
<link rel="monetization" href="https://wallet.example.com/alice" />

<script>
let total = 0
Expand Down Expand Up @@ -43,7 +43,7 @@ The example below illustrates how to use the `monetization` event to show a web
<body>
<p>
Thanks to you, I've made
<span id="total">nothing (yet)</span>
<span id="total">0.00 USD</span>
<span id="currency"></span>
</p>
</body>
Expand All @@ -53,7 +53,7 @@ The example below illustrates how to use the `monetization` event to show a web

First, we'll bind the `monetization` event if the visitor is web monetized (`window.MonetizationEvent` is defined).

The `monetization` event contains details about the payments that occur. The `amountSent` attribute of the event returns the amount (`value`) and currency code of the sent payment. A currency code is a three-letter code, like USD, EUR, or GBP.
The `monetization` event contains details about the payments that occur. The `amountSent` attribute of the event returns the amount (`value`) and currency code of the sent payment. A currency code is a three-letter code, like USD, EUR, or GBP.

```js
if (window.MonetizationEvent) {
Expand Down Expand Up @@ -96,7 +96,7 @@ This example simulates showing a visitor how much they are sending you based off
<ViewAs />
<iframe
src="https://glitch.com/embed/#!/embed/wm2-count-revenue?path=README.md&previewSize=100"
title="wm-count-revenue on Glitch"
style='height:100%;width:100%;border:0;min-height:420px'>
</iframe>
src='https://glitch.com/embed/#!/embed/wm2-count-revenue?path=README.md&previewSize=100'
title='wm-count-revenue on Glitch'
style='height:100%;width:100%;border:0;min-height:420px'
></iframe>
26 changes: 14 additions & 12 deletions src/content/docs/docs/guides/provide-exclusive-content.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The example below illustrates a simple way to show exclusive content to web mone
```html
<head>
<!-- this should be set to your own wallet address -->
<link rel="monetization" href="https://wallet.example/alice" />
<link rel="monetization" href="https://wallet.example.com/alice" />

<style>
.hidden {
Expand Down Expand Up @@ -62,17 +62,17 @@ document.getElementById('exclusive').classList.remove('hidden')
### Interactive example
This example simulates hiding and showing exclusive content based on a visitor's Web Monetization state.
This example simulates hiding and showing exclusive content based on a visitor's Web Monetization state.
<NoPay />
<ViewAs />
<iframe
src="https://glitch.com/embed/#!/embed/wm2-exclusive-content-basic?path=README.md&previewSize=100"
title="wm-exclusive-content-basic on Glitch"
style='height:100%;width:100%;border:0;min-height:420px'>
</iframe>
src='https://glitch.com/embed/#!/embed/wm2-exclusive-content-simple?path=README.md&previewSize=100'
title='wm-exclusive-content-basic on Glitch'
style='height:100%;width:100%;border:0;min-height:420px'
></iframe>
## Example 2 - Complex
Expand Down Expand Up @@ -100,9 +100,9 @@ The example below covers three states for showing:

<script>
function showExclusiveContent() {
document.getElementById('exclusive').classList.remove('hidden')
document.getElementById('loading').classList.add('hidden')
document.getElementById('cta').classList.add('hidden')
document.getElementById('exclusive').classList.remove('hidden')
}

function showCTA() {
Expand Down Expand Up @@ -134,7 +134,9 @@ The example below covers three states for showing:
<body>
<div id="loading" class="hidden">Loading exclusive content...</div>
<div id="exclusive" class="hidden">Here's some exclusive content!</div>
<div id="cta" class="hidden">Please install a Web Monetization extension to support me!</div>
<div id="cta" class="hidden">
Please install a Web Monetization extension to support me!
</div>
</body>
```
Expand Down Expand Up @@ -183,7 +185,7 @@ This example simulates hiding and showing exclusive content based on a visitor's
<ViewAs />

<iframe
src="https://glitch.com/embed/#!/embed/wm2-exclusive-content-advanced?path=README.md&previewSize=100"
title="wm-exclusive-content-advanced on Glitch"
style='height:100%;width:100%;border:0;min-height:420px'>
</iframe>
src='https://glitch.com/embed/#!/embed/wm2-exclusive-content-complex?path=README.md&previewSize=100'
title='wm-exclusive-content-advanced on Glitch'
style='height:100%;width:100%;border:0;min-height:420px'
></iframe>
22 changes: 12 additions & 10 deletions src/content/docs/docs/guides/remove-ads.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ The example below shows how to remove ads from web monetized visitors.
```html
<head>
<!-- Set the href to your own wallet address -->
<link rel="monetization" href="https://wallet.example/alice" />
<link rel="monetization" href="https://wallet.example.com/alice" />

<script>
const adCode = '<div style="border:1px solid #f00;color:red;margin:20px">Ad! Buy product A! Ad!</div>'
const adCode =
'<div style="border:1px solid #f00;color:red;margin:20px">Ad! Buy product A! Ad!</div>'
function showAds() {
document.getElementById('ad').innerHTML = adCode
}
Expand All @@ -41,7 +42,7 @@ The example below shows how to remove ads from web monetized visitors.
let hasPaid = false
if (window.MonetizationEvent) {
const link = document.querySelector('link[rel="monetization"]')
link.addEventListener('monetization', (ev) => {
link.addEventListener('monetization', () => {
hasPaid = true
removeAds()
})
Expand Down Expand Up @@ -72,7 +73,8 @@ The example below shows how to remove ads from web monetized visitors.
Let's start with the code for showing an ad.

```jsx
const adCode = '<div style="border:1px solid #f00;color:red;margin:20px">Ad! Buy product A! Ad!</div>'
const adCode =
'<div style="border:1px solid #f00;color:red;margin:20px">Ad! Buy product A! Ad!</div>'
function showAds() {
document.getElementById('ad').innerHTML = adCode
}
Expand All @@ -86,7 +88,7 @@ The `hasPaid` variable in the timer is for when/if Web Monetization starts after
let hasPaid = false
if (window.MonetizationEvent) {
const link = document.querySelector('link[rel="monetization"]')
link.addEventListener('monetization', (ev) => {
link.addEventListener('monetization', () => {
hasPaid = true
removeAds()
})
Expand All @@ -113,14 +115,14 @@ window.addEventListener('load', () => {

## Interactive example

This example simulates showing and hiding an ad based on a visitor's Web Monetization state.
This example simulates showing and hiding an ad based on a visitor's Web Monetization state.

<NoPay />

<ViewAs />

<iframe
src="https://glitch.com/embed/#!/embed/wm2-ad-free-experience?path=README.md&previewSize=100"
title="wm-ad-free-experience on Glitch"
style='height:100%;width:100%;border:0;min-height:420px'>
</iframe>
src='https://glitch.com/embed/#!/embed/wm2-ad-free-experience?path=README.md&previewSize=100'
title='wm-ad-free-experience on Glitch'
style='height:100%;width:100%;border:0;min-height:420px'
></iframe>
Loading

0 comments on commit 6a55c6d

Please sign in to comment.