Skip to content

Commit

Permalink
Make CI lint happy and gate create-user btn
Browse files Browse the repository at this point in the history
  • Loading branch information
theoilie committed Apr 25, 2024
1 parent 91a2f1a commit 310c5df
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 27 deletions.
10 changes: 5 additions & 5 deletions packages/ddex/webapp/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"type": "module",
"scripts": {
"start": "vite",
"start:dev": "IS_DEV=true env-cmd -f .env.dev turbo run start --filter=@audius/ddex-webapp-client",
"start:stage": "IS_DEV=true env-cmd -f .env.stage.local turbo run start --filter=@audius/ddex-webapp-client",
"start:prod": "IS_DEV=true env-cmd -f .env.prod.local turbo run start --filter=@audius/ddex-webapp-client",
"preview:stage": "IS_DEV=true env-cmd -f .env.stage.local vite build && vite preview",
"preview:prod": "IS_DEV=true env-cmd -f .env.prod.local vite build && vite preview",
"start:dev": "VITE_IS_DEV=true env-cmd -f .env.dev turbo run start --filter=@audius/ddex-webapp-client",
"start:stage": "VITE_IS_DEV=true env-cmd -f .env.stage.local turbo run start --filter=@audius/ddex-webapp-client",
"start:prod": "VITE_IS_DEV=true env-cmd -f .env.prod.local turbo run start --filter=@audius/ddex-webapp-client",
"preview:stage": "VITE_IS_DEV=true env-cmd -f .env.stage.local vite build && vite preview",
"preview:prod": "VITE_IS_DEV=true env-cmd -f .env.prod.local vite build && vite preview",
"build": "tsc && vite build",
"serve": "vite preview",
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
Expand Down
4 changes: 2 additions & 2 deletions packages/ddex/webapp/client/src/pages/Releases/Releases.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ const Table = ({ data }: { data: CollectionData }) => {
{item?.sdk_upload_metadata?.title
? 'track'
: item?.sdk_upload_metadata?.playlist_name
? 'album'
: 'unknown'}
? 'album'
: 'unknown'}
</td>
<td>
{item?.sdk_upload_metadata?.artist_id ||
Expand Down
40 changes: 21 additions & 19 deletions packages/ddex/webapp/client/src/pages/Users/Users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ const Table = ({ data }: { data: CollectionData }) => {
)
}

// TODO: Only show the "Create Test User" button when IS_DEV=true in the environment
const Users = () => {
const [userName, setUserName] = useState('')
const createUser = trpc.users.createUser.useMutation()
const isDev = import.meta.env.VITE_IS_DEV // Only allow creating test users in dev

const handleCreateUser = () => {
if (userName.trim()) {
Expand All @@ -60,24 +60,26 @@ const Users = () => {
}

return (
<TableLayout title='Releases'>
<Flex
direction='row'
gap='s'
alignItems='center'
style={{ maxWidth: '400px' }}
>
<TextInput
label='New Artist Name'
placeholder='Enter artist name'
value={userName}
size={TextInputSize.SMALL}
onChange={(e) => setUserName(e.target.value)}
/>
<Button variant='secondary' size='small' onClick={handleCreateUser}>
Create Test User
</Button>
</Flex>
<TableLayout title='Users'>
{isDev && (
<Flex
direction='row'
gap='s'
alignItems='center'
style={{ maxWidth: '400px' }}
>
<TextInput
label='New Artist Name'
placeholder='Enter artist name'
value={userName}
size={TextInputSize.SMALL}
onChange={(e) => setUserName(e.target.value)}
/>
<Button variant='secondary' size='small' onClick={handleCreateUser}>
Create Test User
</Button>
</Flex>
)}
<PaginatedTable
queryFunction={trpc.users.getUsers.useQuery}
TableDisplay={Table}
Expand Down
2 changes: 1 addition & 1 deletion packages/ddex/webapp/client/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { defineConfig } from 'vite'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
import tsconfigPaths from 'vite-tsconfig-paths'

const isDevelopment = process.env.IS_DEV === 'true'
const isDevelopment = process.env.VITE_IS_DEV === 'true'

export default defineConfig({
server: {
Expand Down

0 comments on commit 310c5df

Please sign in to comment.