Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
mudkipme committed Jul 3, 2024
1 parent 0475ad6 commit 07afcea
Show file tree
Hide file tree
Showing 55 changed files with 4,948 additions and 3,395 deletions.
21 changes: 0 additions & 21 deletions .eslintrc.js

This file was deleted.

16 changes: 16 additions & 0 deletions dprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"typescript": {
"semiColons": "asi",
"quoteStyle": "preferSingle",
"trailingCommas": "never",
"functionDeclaration.spaceBeforeParentheses": true,
"constructor.spaceBeforeParentheses": true,
"method.spaceBeforeParentheses": true
},
"excludes": [
"**/node_modules"
],
"plugins": [
"https://plugins.dprint.dev/typescript-0.91.2.wasm"
]
}
32 changes: 32 additions & 0 deletions eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const love = require('eslint-config-love')
const reactHooks = require('eslint-plugin-react-hooks')

module.exports = [
{
...love,
files: ['packages/**/*.ts', 'packages/**/*.tsx'],
plugins: {
...love.plugins,
'react-hooks': reactHooks
},
languageOptions: {
...love.languageOptions,
parserOptions: {
project: ['./packages/*/tsconfig.json']
}
},
ignores: ['build', 'dist', 'node_modules', 'eslint.config.cjs'],
rules: {
...love.rules,
...reactHooks.configs.recommended.rules,
'@typescript-eslint/no-misused-promises': [
'error',
{
checksVoidReturn: {
properties: false
}
}
]
}
}
]
13 changes: 4 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,9 @@
"build": "pnpm run -r build"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^6.5.0",
"@typescript-eslint/parser": "^6.5.0",
"eslint": "^8.48.0",
"eslint-config-standard-with-typescript": "^39.0.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-n": "^16.0.2",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react-hooks": "^4.6.0",
"typescript": "^5.2.2"
"eslint": "^8.57.0",
"eslint-config-love": "^53.0.0",
"eslint-plugin-react-hooks": "^4.6.2",
"typescript": "^5.5.3"
}
}
24 changes: 12 additions & 12 deletions packages/klinklang-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@
"url": "https://github.com/mudkipme/klinklang/issues"
},
"devDependencies": {
"vite": "^4.5.3"
"vite": "^5.3.3"
},
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.14.7",
"@mui/material": "^5.14.7",
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@vitejs/plugin-react": "^4.0.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.15.0",
"zustand": "^4.4.1"
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@mui/icons-material": "^5.15.21",
"@mui/material": "^5.15.21",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.24.0",
"zustand": "^4.5.4"
}
}
22 changes: 17 additions & 5 deletions packages/klinklang-client/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Box, Drawer, Toolbar, Typography } from '@mui/material'
import React, { useEffect, useState } from 'react'
import { KlinklangHeader } from './components/Header'
import { Outlet } from 'react-router-dom'
import { KlinklangMenu } from './components/Menu'
import { KlinklangFooter } from './components/Footer'
import { KlinklangHeader } from './components/Header'
import { KlinklangMenu } from './components/Menu'
import { useUserStore } from './store/user'

export const App: React.FC = () => {
Expand All @@ -16,14 +16,26 @@ export const App: React.FC = () => {

return (
<Box>
<Drawer open={drawerOpen} onClose={() => { setDrawerOpen(false) }} onClick={() => { setDrawerOpen(false) }}>
<Drawer
open={drawerOpen}
onClose={() => {
setDrawerOpen(false)
}}
onClick={() => {
setDrawerOpen(false)
}}
>
<Box padding={2} width={256}>
<Typography variant='h6'>Klinklang</Typography>
<Typography variant="subtitle2" color="text.secondary">Utilities for 52Poké Wiki</Typography>
<Typography variant='subtitle2' color='text.secondary'>Utilities for 52Poké Wiki</Typography>
</Box>
<KlinklangMenu />
</Drawer>
<KlinklangHeader onDrawerOpen={() => { setDrawerOpen(true) }} />
<KlinklangHeader
onDrawerOpen={() => {
setDrawerOpen(true)
}}
/>
<Toolbar />
<Outlet />
<KlinklangFooter />
Expand Down
4 changes: 2 additions & 2 deletions packages/klinklang-client/src/components/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import React from 'react'
export const KlinklangFooter: React.FC = () => {
return (
<Container sx={{ padding: 2 }}>
<Typography variant="body2">
&copy; <Link href="https://52poke.wiki" color="inherit">52Poké Wiki</Link>
<Typography variant='body2'>
&copy; <Link href='https://52poke.wiki' color='inherit'>52Poké Wiki</Link>
</Typography>
</Container>
)
Expand Down
72 changes: 52 additions & 20 deletions packages/klinklang-client/src/components/Header/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
import { AppBar, Divider, IconButton, ListItemIcon, ListItemText, Menu, MenuItem, Toolbar, Typography } from '@mui/material'
import React, { useCallback, useState } from 'react'
import MenuIcon from '@mui/icons-material/Menu'
import AccountCircle from '@mui/icons-material/AccountCircle'
import Face from '@mui/icons-material/Face'
import LoginIcon from '@mui/icons-material/Login'
import LogoutIcon from '@mui/icons-material/Logout'
import { useUserStore } from '../../store/user'
import MenuIcon from '@mui/icons-material/Menu'
import {
AppBar,
Divider,
IconButton,
ListItemIcon,
ListItemText,
Menu,
MenuItem,
Toolbar,
Typography
} from '@mui/material'
import React, { useCallback, useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { useUserStore } from '../../store/user'

export interface KlinklangHeaderProps {
onDrawerOpen: () => void
Expand All @@ -25,21 +35,23 @@ export const KlinklangHeader: React.FC<KlinklangHeaderProps> = ({ onDrawerOpen }
<AppBar>
<Toolbar>
<IconButton
color="inherit"
edge="start"
color='inherit'
edge='start'
sx={{ mr: 2 }}
onClick={onDrawerOpen}
>
<MenuIcon />
</IconButton>
<Typography variant="h6" component="div" sx={{ flexGrow: 1 }}>
<Typography variant='h6' component='div' sx={{ flexGrow: 1 }}>
52Poké Wiki Utilities
</Typography>
<div>
<IconButton
color="inherit"
size="large"
onClick={(e) => { setAnchorEl(e.currentTarget) }}
color='inherit'
size='large'
onClick={(e) => {
setAnchorEl(e.currentTarget)
}}
>
<AccountCircle />
</IconButton>
Expand All @@ -55,25 +67,45 @@ export const KlinklangHeader: React.FC<KlinklangHeaderProps> = ({ onDrawerOpen }
horizontal: 'right'
}}
open={anchorEl !== null}
onClose={() => { setAnchorEl(null) }}
onClose={() => {
setAnchorEl(null)
}}
>
{currentUser !== null
? [
<MenuItem onClick={() => { navigate('/pages/settings'); setAnchorEl(null) }} key="settings">
<ListItemIcon><Face /></ListItemIcon>
<MenuItem
onClick={() => {
navigate('/pages/settings')
setAnchorEl(null)
}}
key='settings'
>
<ListItemIcon>
<Face />
</ListItemIcon>
<ListItemText>{currentUser.name}</ListItemText>
</MenuItem>,
<Divider key="divider" />,
<MenuItem onClick={() => { logout().catch(console.log) }} key="logout">
<ListItemIcon><LogoutIcon /></ListItemIcon>
<Divider key='divider' />,
<MenuItem
onClick={() => {
logout().catch(console.log)
}}
key='logout'
>
<ListItemIcon>
<LogoutIcon />
</ListItemIcon>
<ListItemText>Logout</ListItemText>
</MenuItem>
]
: <MenuItem onClick={login}>
<ListItemIcon><LoginIcon /></ListItemIcon>
]
: (
<MenuItem onClick={login}>
<ListItemIcon>
<LoginIcon />
</ListItemIcon>
<ListItemText>Login</ListItemText>
</MenuItem>
}
)}
</Menu>
</div>
</Toolbar>
Expand Down
13 changes: 7 additions & 6 deletions packages/klinklang-client/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import * as React from 'react'
import * as ReactDOM from 'react-dom/client'
import { ThemeProvider } from '@emotion/react'
import { CssBaseline } from '@mui/material'
import theme from './theme'
import * as React from 'react'
import * as ReactDOM from 'react-dom/client'
import { createBrowserRouter, RouterProvider } from 'react-router-dom'
import { App } from './App'
import { RouterProvider, createBrowserRouter } from 'react-router-dom'
import { Settings } from './pages/Settings'
import { TermReplacer } from './pages/TermReplacer'
import { Workflows } from './pages/Workflows'
import { Settings } from './pages/Settings'
import theme from './theme'

const router = createBrowserRouter([
{
Expand All @@ -34,7 +34,8 @@ const router = createBrowserRouter([
}
])

ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<ThemeProvider theme={theme}>
<CssBaseline />
Expand Down
53 changes: 41 additions & 12 deletions packages/klinklang-client/src/pages/Settings/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
import { Button, Card, CardContent, Container, Grid, IconButton, List, ListItem, ListItemText, Stack, TextField, Typography } from '@mui/material'
import { Delete } from '@mui/icons-material'
import {
Button,
Card,
CardContent,
Container,
Grid,
IconButton,
List,
ListItem,
ListItemText,
Stack,
TextField,
Typography
} from '@mui/material'
import React, { useCallback, useRef } from 'react'
import { useUserStore } from '../../store/user'
import { Delete } from '@mui/icons-material'

export const Settings: React.FC = () => {
const domainEl = useRef<HTMLInputElement | null>(null)
Expand Down Expand Up @@ -44,14 +57,23 @@ export const Settings: React.FC = () => {
<Grid item xs={12} sm={6}>
<Card>
<CardContent>
<Typography variant="h5">Linked ActivityPub accounts</Typography>
<Typography variant='h5'>Linked ActivityPub accounts</Typography>
<List>
{currentUser?.fediAccounts?.map((account) => (
<ListItem key={account.subject} disablePadding secondaryAction={(
<IconButton edge="end" onClick={() => { deleteFediAccount(account.id).catch(console.log) }}>
<Delete />
</IconButton>
)}>
<ListItem
key={account.subject}
disablePadding
secondaryAction={
<IconButton
edge='end'
onClick={() => {
deleteFediAccount(account.id).catch(console.log)
}}
>
<Delete />
</IconButton>
}
>
<ListItemText>{account.subject}</ListItemText>
</ListItem>
))}
Expand All @@ -63,10 +85,17 @@ export const Settings: React.FC = () => {
<Grid item xs={12} sm={6}>
<Card>
<CardContent>
<Typography variant="h5" mb={2}>Link to a new ActivityPub account</Typography>
<Stack direction="row" spacing={2}>
<TextField inputRef={domainEl} label="Your instance domain" size="small" />
<Button variant="contained" onClick={() => { fediConnect().catch(console.log) }}>Connect</Button>
<Typography variant='h5' mb={2}>Link to a new ActivityPub account</Typography>
<Stack direction='row' spacing={2}>
<TextField inputRef={domainEl} label='Your instance domain' size='small' />
<Button
variant='contained'
onClick={() => {
fediConnect().catch(console.log)
}}
>
Connect
</Button>
</Stack>
</CardContent>
</Card>
Expand Down
Loading

0 comments on commit 07afcea

Please sign in to comment.