-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PROTO-1726] Start simple entrypoint for distro (#8104)
- Loading branch information
1 parent
4180e1a
commit 7182221
Showing
21 changed files
with
2,054 additions
and
335 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module.exports = { | ||
root: true, | ||
env: { browser: true, es2020: true }, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:react-hooks/recommended', | ||
], | ||
ignorePatterns: ['dist', '.eslintrc.cjs'], | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['react-refresh'], | ||
rules: { | ||
'react-refresh/only-export-components': [ | ||
'warn', | ||
{ allowConstantExport: 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
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? |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# DDEX entrypoint | ||
|
||
Found at distro.audius.co. | ||
|
||
Simple redirects to relevant DDEX apps. | ||
|
||
## Development | ||
``` | ||
npm run dev | ||
``` | ||
|
||
## Deployment | ||
``` | ||
npm run deploy | ||
``` |
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
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? |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" href="/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Audius Distro</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js"></script> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "entrypoint", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "tsc && vite build", | ||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", | ||
"preview": "vite preview", | ||
"start": "npm run preview", | ||
"deploy": "npm run build && wrangler pages deploy ./dist" | ||
}, | ||
"dependencies": { | ||
"@audius/sdk": "*", | ||
"@audius/harmony": "*", | ||
"react": "18.2.0", | ||
"react-dom": "18.2.0" | ||
}, | ||
"devDependencies": { | ||
"@esbuild-plugins/node-globals-polyfill": "0.2.3", | ||
"@types/react": "18.2.0", | ||
"@types/react-dom": "18.2.0", | ||
"@typescript-eslint/eslint-plugin": "6.0.0", | ||
"@typescript-eslint/parser": "6.0.0", | ||
"@vitejs/plugin-react": "4.0.3", | ||
"eslint": "8.45.0", | ||
"eslint-plugin-react-hooks": "4.6.0", | ||
"eslint-plugin-react-refresh": "0.4.3", | ||
"typescript": "5.0.2", | ||
"vite": "4.4.5", | ||
"wrangler": "3.30.1" | ||
} | ||
} |
Binary file not shown.
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
import { useCallback } from 'react' | ||
import { | ||
ThemeProvider as HarmonyThemeProvider, | ||
IconArrowRight, | ||
IconAudiusLogoHorizontal, | ||
IconAudiusLogoHorizontalColor, | ||
Paper, | ||
Text, | ||
TextLink | ||
} from '@audius/harmony' | ||
import { Button, Flex } from '@audius/harmony' | ||
|
||
const messages = { | ||
connect: 'Connect Distributor', | ||
access: 'Grant your provider access to publish songs to Audius on your behalf.', | ||
choose: 'Please choose your distributor', | ||
login: 'Log in with Audius', | ||
questions: 'Got questions', | ||
learnMore: 'Learn more', | ||
privacy: 'Privacy', | ||
terms: 'Terms', | ||
developers: 'Developers', | ||
audius: 'Audius' | ||
} | ||
|
||
const links = { | ||
privacy: 'https://audius.co/legal/privacy-policy', | ||
terms: 'https://audius.co/legal/terms-of-use', | ||
developers: 'https://docs.audius.org', | ||
audius: 'https://audius.co' | ||
} | ||
|
||
const Footer = () => { | ||
return ( | ||
<footer> | ||
<Flex | ||
justifyContent='space-between' | ||
alignItems='center' | ||
backgroundColor='surface1' | ||
ph='2xl' | ||
h={'unit8'} | ||
> | ||
<Flex alignItems='center' gap='2xl'> | ||
<Flex alignItems='center' gap='s'> | ||
<IconAudiusLogoHorizontal width={'80px'} height={'20px'} color='subdued' /> | ||
<Text | ||
variant='body' | ||
size='s' | ||
color='subdued' | ||
> | ||
© {new Date().getFullYear()} | ||
</Text> | ||
</Flex> | ||
<TextLink | ||
variant='subdued' | ||
textVariant='body' | ||
size='s' | ||
color='subdued' | ||
href={links.privacy} | ||
>{messages.privacy}</TextLink> | ||
<TextLink | ||
variant='subdued' | ||
textVariant='body' | ||
size='s' | ||
color='subdued' | ||
href={links.terms} | ||
>{messages.terms}</TextLink> | ||
</Flex> | ||
<Flex alignItems='center' gap='2xl'> | ||
<TextLink | ||
variant='subdued' | ||
textVariant='body' | ||
size='s' | ||
color='subdued' | ||
href={links.developers} | ||
>{messages.developers}</TextLink> | ||
<TextLink | ||
variant='subdued' | ||
textVariant='body' | ||
size='s' | ||
color='subdued' | ||
href={links.audius} | ||
>{messages.audius}</TextLink> | ||
</Flex> | ||
</Flex> | ||
</footer> | ||
) | ||
} | ||
|
||
|
||
export default function App() { | ||
const onClickLogin = useCallback(() => { | ||
window.open('http://localhost:5174/login?auto=true', '_self') | ||
}, []) | ||
|
||
return ( | ||
<HarmonyThemeProvider theme='day'> | ||
<Flex | ||
direction='column' | ||
backgroundColor='default' | ||
h={'100vh'} | ||
> | ||
<Flex | ||
flex={1} | ||
gap='m' | ||
justifyContent='center' | ||
alignItems='center' | ||
> | ||
<Paper | ||
h='460px' | ||
w='416px' | ||
direction='column' | ||
p='2xl' | ||
gap='2xl' | ||
> | ||
<Flex justifyContent='center'> | ||
<IconAudiusLogoHorizontalColor /> | ||
</Flex> | ||
<Text | ||
variant='heading' | ||
size='l' | ||
color='accent' | ||
textAlign='center' | ||
> | ||
{messages.connect} | ||
</Text> | ||
<Text | ||
variant='body' | ||
size='m' | ||
textAlign='center' | ||
color='default' | ||
> | ||
{messages.access} | ||
</Text> | ||
<Text | ||
variant='body' | ||
size='m' | ||
color='default' | ||
> | ||
{`${messages.choose}:`} | ||
</Text> | ||
<Button | ||
variant='primary' | ||
onClick={onClickLogin} | ||
iconRight={IconArrowRight} | ||
> | ||
{messages.login} | ||
</Button> | ||
</Paper> | ||
</Flex> | ||
<Footer /> | ||
</Flex> | ||
</HarmonyThemeProvider> | ||
) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import '@emotion/react' | ||
import type { HarmonyTheme } from '@audius/harmony' | ||
|
||
declare module '@emotion/react' { | ||
export interface Theme extends HarmonyTheme {} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from 'react' | ||
import ReactDOM from 'react-dom/client' | ||
import App from './App.tsx' | ||
import '@audius/harmony/dist/harmony.css' | ||
|
||
ReactDOM.createRoot(document.getElementById('root')!).render( | ||
<React.StrictMode> | ||
<App /> | ||
</React.StrictMode> | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/// <reference types="vite/client" /> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2020", | ||
"useDefineForClassFields": true, | ||
"lib": ["ES2020", "DOM", "DOM.Iterable"], | ||
"module": "ESNext", | ||
"skipLibCheck": true, | ||
"jsxImportSource": "@emotion/react", | ||
|
||
/* Bundler mode */ | ||
"moduleResolution": "node", | ||
"allowImportingTsExtensions": true, | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"noEmit": true, | ||
"jsx": "react-jsx", | ||
|
||
/* Linting */ | ||
"strict": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noFallthroughCasesInSwitch": true, | ||
|
||
"allowSyntheticDefaultImports": true | ||
}, | ||
"include": ["src"], | ||
"references": [{ "path": "./tsconfig.node.json" }] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"composite": true, | ||
"skipLibCheck": true, | ||
"module": "ESNext", | ||
"moduleResolution": "bundler", | ||
"allowSyntheticDefaultImports": true | ||
}, | ||
"include": ["vite.config.ts"] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { defineConfig } from 'vite' | ||
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill' | ||
import react from '@vitejs/plugin-react' | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
plugins: [react()], | ||
optimizeDeps: { | ||
esbuildOptions: { | ||
define: { | ||
global: 'globalThis' | ||
}, | ||
plugins: [ | ||
NodeGlobalsPolyfillPlugin({ | ||
buffer: 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
Oops, something went wrong.