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: w3console example app #255

Merged
merged 112 commits into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
c824e44
feat!: integrate new ucanto and upload-client (#119)
Dec 2, 2022
012a565
fix: update vanilla sign-up example (#129)
yusefnapora Dec 2, 2022
0110ae8
fix: update vue examples (#130)
travis Dec 2, 2022
9ccbe67
fix: update solid examples (#131)
travis Dec 2, 2022
8699b40
docs: update docs for new ucanto integration (#135)
yusefnapora Dec 2, 2022
034ada0
chore: update access-client version
Dec 2, 2022
18e976a
feat: introduce react-ui package
travis Dec 1, 2022
e7737c4
fix: render Uploader children rather than markup
travis Dec 1, 2022
89050e8
chore: move to typescript
travis Dec 2, 2022
c4d74e6
wip: initial version of react ui example app
travis Dec 2, 2022
7ec7c33
chore: move Uploader into react-uploader package (#137)
travis Dec 5, 2022
ec98de1
chore: add docstrings to uploader state and component
travis Dec 5, 2022
0454d94
fix: use preferred CID link
travis Dec 5, 2022
bb0e2b2
fix: correct typo
travis Dec 6, 2022
6dec856
feat: UploadsList components (#141)
travis Dec 7, 2022
ba91721
feat: Add Authenticator and SimpleAuthenticator (#152)
travis Dec 9, 2022
b9802ec
Merge branch 'main' into feat/w3ui-ui
travis Dec 15, 2022
ff0b3d4
fix: unclutter PR
travis Dec 15, 2022
27c4de7
fix: one more extraneous change
travis Dec 15, 2022
4896a4a
fix: delete unecessary dev dependencies
travis Dec 15, 2022
0932d8c
fix: clear out package-log.json and reinstall to fix build issues
travis Dec 15, 2022
560676b
chore: appease linter
travis Dec 15, 2022
fdcce6e
fix: a few more linting and compilation errors
travis Dec 15, 2022
642b68c
fix: update react uploads list example
travis Dec 15, 2022
7072602
fix: update vue examples
travis Dec 19, 2022
110907f
feat: W3Upload "drop in" component (#155)
travis Dec 19, 2022
a0220fd
Merge branch 'fix/react-uploads-list' into feat/w3ui-ui
travis Dec 19, 2022
9c5374a
Merge branch 'fix/update-vue-examples' into feat/w3ui-ui
travis Dec 19, 2022
e6a3002
fix: typo
travis Dec 19, 2022
45a605e
fix: Fix docs link from react-uploads-list to keyring page (#196)
natevw Jan 4, 2023
0e5cf4c
Merge branch 'main' into feat/w3ui-ui
travis Jan 4, 2023
7829770
fix: remove react-ui package and react/ui example
travis Jan 4, 2023
93b7ee0
fix: remove react-ui typescript and rollup configs
travis Jan 4, 2023
9b278e2
chore: add basic docs to the react keyring and uploads list
travis Jan 4, 2023
2eaff3a
chore: a bit more documentation
travis Jan 4, 2023
09c362b
fix: remove circular dependency
travis Jan 5, 2023
c7bf2bf
Revert "fix: remove react-ui typescript and rollup configs"
travis Jan 4, 2023
7882010
Revert "fix: remove react-ui package and react/ui example"
travis Jan 4, 2023
a2c206d
fix: assorted fixes for pnpm compatibility
travis Jan 5, 2023
7723cfd
Merge branch 'main' into feat/customizable-ui
travis Jan 5, 2023
4b85682
Merge branch 'main' into feat/w3ui-ui
travis Jan 5, 2023
9fc7505
Merge branch 'main' into feat/w3ui-ui
travis Jan 6, 2023
ba8b2f9
fix: don't let callers override important properties
travis Jan 9, 2023
cd140a7
fix: Cid -> CID and tweak storedDAGShards typing
travis Jan 9, 2023
9a02e03
fix: tweaks from review
travis Jan 9, 2023
cf6a576
Merge branch 'main' into feat/w3ui-ui
travis Jan 9, 2023
d7fae7c
fix: one more arrow function conversion
travis Jan 9, 2023
8a7e0ad
feat: use an enum for uploader status
travis Jan 9, 2023
5d74af8
feat: support `as` prop in uploader components
travis Jan 7, 2023
4839cdf
feat: use ariakit-react-utils to build all headless components
travis Jan 10, 2023
411c81e
Merge branch 'feat/headless-as' into feat/customizable-ui
travis Jan 10, 2023
a13231d
wip: working on getting UploadsListRoot working as expected
travis Jan 10, 2023
f3f3927
feat: get a version of UploadsListRoot working
travis Jan 10, 2023
de61dd8
feat: get a version of UploadsListRoot working
travis Jan 10, 2023
50a8f90
Merge branch 'feat/headless-as' into feat/customizable-ui
travis Jan 10, 2023
3c9493e
Apply suggestions from code review
travis Jan 10, 2023
139499b
chore: get function names in example programmatically
travis Jan 10, 2023
be83037
fix: use function name rather than the entire implementation
travis Jan 10, 2023
f4d3fda
fix: move back to preferred import style in SimpleUploader
travis Jan 11, 2023
0c3005c
feat: use css variable-based styles to enable customization
travis Jan 11, 2023
713abcc
fix: don't smother error in authenticator
travis Jan 11, 2023
f1a46b4
fix: unfurl props first in components
travis Jan 11, 2023
0cea4b6
Merge branch 'feat/w3ui-ui' into feat/headless-as
travis Jan 11, 2023
f8ddd20
Merge branch 'feat/headless-as' into feat/customizable-ui
travis Jan 11, 2023
d333c00
fix: change type of children in a few places
travis Jan 12, 2023
85d9ea6
fix: update SimpleUploadsList headers
travis Jan 12, 2023
199e24a
fix: export W3API provider
travis Jan 12, 2023
163e7f2
feat: add new w3console app
travis Jan 11, 2023
860c0f9
fix: tweak config and run linter
travis Jan 11, 2023
af7928f
feat: add basic UI
travis Jan 12, 2023
89858fd
Merge branch 'feat/css-variables' into feat/w3console
travis Jan 12, 2023
518a72d
feat: add tailwind for styling
travis Jan 12, 2023
8645fbb
Merge branch 'main' into feat/w3ui-ui
travis Jan 12, 2023
0d3d488
Merge branch 'main' into feat/headless-as
travis Jan 12, 2023
f1e19ea
Merge branch 'main' into feat/w3ui-ui
travis Jan 12, 2023
9534c29
Merge branch 'feat/w3ui-ui' into feat/headless-as
travis Jan 12, 2023
543e27c
fix: headless authenticator bugfixes
travis Jan 12, 2023
959aac3
Merge branch 'fix/headless-bugfixes' into feat/headless-as
travis Jan 12, 2023
4789aae
Merge branch 'feat/headless-as' into feat/customizable-ui
travis Jan 12, 2023
c878f76
Merge branch 'feat/customizable-ui' into feat/w3console
travis Jan 12, 2023
945dc3f
fix: add uploadsList to the render prop props
travis Jan 12, 2023
2d1400b
fix: automatically load the first page of results
travis Jan 12, 2023
9ba973f
Merge branch 'fix/autoload-uploads' into feat/headless-as
travis Jan 12, 2023
374da08
Merge branch 'feat/headless-as' into feat/customizable-ui
travis Jan 12, 2023
71d2001
Merge branch 'feat/customizable-ui' into feat/w3console
travis Jan 12, 2023
84471cf
feat: initial styling work for w3console
travis Jan 12, 2023
4c67e7b
fix: SimpleUploader
travis Jan 13, 2023
d92fbd1
feat: refresh the uploads list after uploading
travis Jan 13, 2023
2374c8a
feat: updates to w3console styling
travis Jan 13, 2023
ba2937a
feat: cleaner uploader
travis Jan 13, 2023
834a50a
fix: don't show console when idle
travis Jan 13, 2023
4213c25
feat: update favicon and title
travis Jan 13, 2023
9c40edf
feat: style SimpleAuthenticator
travis Jan 13, 2023
24e144e
feat: use css variable-based styles to enable customization (#240)
travis Jan 13, 2023
abeedfe
Merge branch 'main' into feat/customizable-ui
travis Jan 13, 2023
30cca9d
Merge branch 'feat/customizable-ui' into feat/w3console
travis Jan 13, 2023
7c4c549
fix: add start script
travis Jan 13, 2023
3faa2bc
fix: various updates from implementing w3console
travis Jan 13, 2023
cd1f679
Merge branch 'feat/customizable-ui' into feat/w3console
travis Jan 13, 2023
24bdbc0
feat: use tailwind's `theme` directive to set CSS variables
travis Jan 13, 2023
5889497
fix: tpyo
travis Jan 13, 2023
44a8be8
fix: doublequote -> singlequot
travis Jan 13, 2023
50735c2
Merge branch 'feat/customizable-ui' into feat/w3console
travis Jan 13, 2023
d9e8023
fix: add missing semicolons
travis Jan 13, 2023
18f766c
Merge remote-tracking branch 'origin/main' into feat/w3console
olizilla Jan 17, 2023
d7ef7c9
chore: update w3console after rename
olizilla Jan 17, 2023
950b39f
chore: remove old name example and package
olizilla Jan 17, 2023
7da3ec2
chore: lint
olizilla Jan 17, 2023
7bafb38
chore: fix lock
olizilla Jan 17, 2023
4b564e5
feat: console sidebar layout
olizilla Jan 17, 2023
1f15f35
chore: add logo and custom dark-gray from w3ui-website
olizilla Jan 17, 2023
3d563c2
fix: make the linter happy
travis Jan 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions examples/react/w3console/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
13 changes: 13 additions & 0 deletions examples/react/w3console/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en" class="h-full bg-gray-dark">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>w3console</title>
</head>
<body class="h-full">
<div id="app"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
28 changes: 28 additions & 0 deletions examples/react/w3console/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "w3console",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"start": "vite",
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview"
},
"dependencies": {
"@w3ui/react": "workspace:^",
"@w3ui/react-keyring": "workspace:^",
"@w3ui/react-uploads-list": "workspace:^2.0.1",
"blueimp-md5": "^2.19.0",
"preact": "^10.11.3"
},
"devDependencies": {
"@preact/preset-vite": "^2.4.0",
"@types/blueimp-md5": "^2.18.0",
"autoprefixer": "^10.4.13",
"postcss": "^8.4.21",
"tailwindcss": "^3.2.4",
"typescript": "^4.9.3",
"vite": "^4.0.0"
}
}
6 changes: 6 additions & 0 deletions examples/react/w3console/postcss.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {}
}
}
Binary file added examples/react/w3console/public/favicon.ico
Binary file not shown.
54 changes: 54 additions & 0 deletions examples/react/w3console/src/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { Authenticator, Uploader, UploadsList, W3APIProvider } from '@w3ui/react'
import { useKeyring } from '@w3ui/react-keyring'
import { useUploadsList } from '@w3ui/react-uploads-list'
import md5 from 'blueimp-md5'
import '@w3ui/react/src/styles/uploader.css'

function Space (): JSX.Element {
const [{ space }] = useKeyring()
const [, { reload }] = useUploadsList()
return (
<div className='container mx-auto'>
<div className='flex flex-row space-x-4 mb-4 justify-between'>
<div className='shrink-0'>
{(space !== undefined) && (
<img src={`https://www.gravatar.com/avatar/${md5(space.did())}?d=identicon`} className='w-20' />
)}
</div>
<Uploader onUploadComplete={() => { void reload() }} />
</div>
<UploadsList />
</div>
)
}

export function App (): JSX.Element {
return (
<W3APIProvider>
<Authenticator>
<div className='flex min-h-full w-full'>
<nav className='flex-none w-72 bg-white p-4 border-r border-gray-200'>
<div className='flex flex-col justify-between min-h-full'>
<div className='grow'>
<h1 className='font-bold pb-4 flex flex-row justify-start items-center gap-2'>
<svg className='site-logo-image text-black' width='30' viewBox='0 0 27.2 27.18' xmlns='http://www.w3.org/2000/svg'><path d='M13.6 27.18A13.59 13.59 0 1127.2 13.6a13.61 13.61 0 01-13.6 13.58zM13.6 2a11.59 11.59 0 1011.6 11.6A11.62 11.62 0 0013.6 2z' fill='currentColor' /><path d='M12.82 9.9v2.53h1.6V9.9l2.09 1.21.77-1.21-2.16-1.32 2.16-1.32-.77-1.21-2.09 1.21V4.73h-1.6v2.53l-2-1.21L10 7.26l2.2 1.32L10 9.9l.78 1.21zM18 17.79v2.52h1.56v-2.52L21.63 19l.78-1.2-2.16-1.33 2.16-1.28-.78-1.19-2.08 1.2v-2.58H18v2.56L15.9 14l-.77 1.2 2.16 1.32-2.16 1.33.77 1.15zM8.13 17.79v2.52h1.56v-2.52L11.82 19l.77-1.2-2.16-1.33 2.12-1.28-.73-1.24-2.13 1.23v-2.56H8.13v2.56L6.05 14l-.78 1.2 2.16 1.3-2.16 1.33.78 1.17z' fill='currentColor' /></svg>
console
</h1>
</div>
<div className='flex-none'>
Space selector
<ul>
<li>space 1</li>
<li className='font-bold'>space 2</li>
</ul>
</div>
</div>
</nav>
<main className='grow bg-gray-100 dark:bg-dark-gray p-4'>
<Space />
</main>
</div>
</Authenticator>
</W3APIProvider>
)
}
1 change: 1 addition & 0 deletions examples/react/w3console/src/assets/preact.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
90 changes: 90 additions & 0 deletions examples/react/w3console/src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
--w3ui-uploader-height: theme(spacing.36);
--w3ui-uploader-primary: theme(colors.orange.400);
--w3ui-uploader-primary-hover: theme(colors.orange.500);
}

.w3-uploads-list {
@apply mb-5;
}

.w3-uploads-list-data {
@apply overflow-auto rounded-md border border-gray-300 dark:border-gray-700;
}

.w3-uploads-list table {
@apply w-full border-collapse divide-y dark:divide-gray-700;
}

.w3-uploads-list thead {
@apply text-left bg-gray-400 dark:bg-gray-900 bg-opacity-50 text-sm;
}

.w3-uploads-list th {
@apply p-3;
}

.w3-uploads-list td {
@apply block w-64 p-3;
}

.w3-uploads-list nav {
@apply flex flex-row space-x-4 my-4;
}

.w3ui-uploader-wrapper {
@apply grow;
}

.w3ui-uploader__file {
@apply rounded-md w-full grid grid-cols-2 p-4 bg-gray-200 dark:bg-gray-900;
}

.w3ui-uploader__file .name {
@apply col-span-2 truncate;
}

.w3ui-uploader__file .type,
.size {
@apply text-sm;
}

.w3ui-uploader-console {
@apply rounded-md w-full bg-gray-200 dark:bg-gray-900 p-4 truncate;
}

.w3ui-simple-authenticator-verify-email {
@apply bg-gray-400 dark:bg-gray-800 px-24 py-16 rounded-md;
}

.w3ui-simple-authenticator-verify-email .message {
@apply text-xl;
}

.w3ui-simple-authenticator-verify-email .detail {
@apply pt-2 pb-4;
}

.w3ui-simple-authenticator {
@apply w-full h-screen flex flex-col justify-center items-center;
}

.w3ui-simple-authenticator-form {
@apply bg-gray-400 dark:bg-gray-800 px-24 py-16 rounded-md;
}

.w3ui-simple-authenticator-form .email-field label {
@apply block mb-2;
}

.w3ui-simple-authenticator-form .email-field input {
@apply rounded block p-2 w-72 bg-gray-300 dark:bg-gray-900;
}

.w3ui-simple-authenticator-form .register {
@apply mt-2;
}
5 changes: 5 additions & 0 deletions examples/react/w3console/src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { render } from 'preact'
import { App } from './app'
import './index.css'

render(<App />, document.getElementById('app') as HTMLElement)
1 change: 1 addition & 0 deletions examples/react/w3console/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'vite/client'
15 changes: 15 additions & 0 deletions examples/react/w3console/tailwind.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./index.html',
'./src/**/*.{js,ts,jsx,tsx}'
],
theme: {
extend: {
colors: {
'gray-dark': '#1d2027'
}
}
},
plugins: []
}
22 changes: 22 additions & 0 deletions examples/react/w3console/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"jsxImportSource": "preact"
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
}
9 changes: 9 additions & 0 deletions examples/react/w3console/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"composite": true,
"module": "ESNext",
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}
10 changes: 10 additions & 0 deletions examples/react/w3console/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from 'vite'
import preact from '@preact/preset-vite'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [preact()],
server: {
port: 3000
}
})
Loading