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

merge(html-preview): added html-preview component and fixed git bugs #10

Merged
merged 13 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
40 changes: 40 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const { configure, presets } = require('eslint-kit')


module.exports = configure({
mode: 'only-errors',
allowDebug: process.env.NODE_ENV !== "production",
root: __dirname,
presets: [
presets.node(),
presets.prettier({
singleQuote: true,
trailingComma: "none",
endOfLine: "auto"
}),
presets.typescript({
root: './',
tsconfig: 'tsconfig.base.json'
}),
presets.react(),
],
extend: {
root: true,
ignorePatterns: ["**/*"],
plugins: ["@nx"],
// My custom config
extends: ["gearonix"],
rules: {
"react/react-in-jsx-scope": "off",
"quotes": [2, "single", { "avoidEscape": true }],
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/member-delimiter-style": ["error", {"multiline" : {"delimiter": "none"}}],
"import/no-unresolved": "off",
"@typescript-eslint/no-unnecessary-condition": "off",
"import/extensions": "off",
"react-hooks/exhaustive-deps": "warn",
"react/no-array-index-key": "warn",
"@typescript-eslint/no-explicit-any": "warn"
}
}
})
14 changes: 0 additions & 14 deletions .eslintrc.json

This file was deleted.

3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"semi": false,
"bracketSpacing": true,
"bracketSameLine": true,
"arrowParens": "always"
"arrowParens": "always",
"singleQuote": true
}
2 changes: 1 addition & 1 deletion apps/client/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['preact'],
extends: ['../../.eslintrc.json'],
extends: ['../../.eslintrc.js'],
ignorePatterns: ['!**/*']
}
12 changes: 6 additions & 6 deletions apps/client/public/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ import { CacheableResponsePlugin } from 'workbox-cacheable-response'
import { ExpirationPlugin } from 'workbox-expiration'
import { precacheAndRoute } from 'workbox-precaching'
import { registerRoute } from 'workbox-routing'
import { CacheFirst,NetworkFirst, StaleWhileRevalidate } from 'workbox-strategies'
import {
CacheFirst,
NetworkFirst,
StaleWhileRevalidate
} from 'workbox-strategies'

precacheAndRoute(self.__WB_MANIFEST)

self.addEventListener('message', (event) => {
if (event.data && event.data.type === 'SKIP_WAITING')
self.skipWaiting()
if (event.data && event.data.type === 'SKIP_WAITING') self.skipWaiting()
})

registerRoute(
Expand All @@ -23,8 +26,6 @@ registerRoute(
})
)



registerRoute(
/http:\/\/localhost\/:6868/,
new NetworkFirst({
Expand Down Expand Up @@ -68,4 +69,3 @@ registerRoute(
]
})
)

20 changes: 0 additions & 20 deletions apps/client/src/app/App.tsx

This file was deleted.

20 changes: 20 additions & 0 deletions apps/client/src/app/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { ThemeProvider } from '@/app/providers/theme'
import { GlobalStyles } from '@/app/styles'

import { RouterProvider } from './providers/router'
import { StoreProvider } from './providers/store'

import 'normalize.css'

function App() {
return (
<StoreProvider>
<ThemeProvider>
<RouterProvider />
<GlobalStyles />
</ThemeProvider>
</StoreProvider>
)
}

export default App
7 changes: 2 additions & 5 deletions apps/client/src/app/entry.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { render } from 'preact'
import { registerSW } from 'virtual:pwa-register'

import App from './App'
import App from './app'

const updateSW = registerSW({
onNeedRefresh() {
Expand All @@ -11,7 +11,4 @@
}
})


render(<App />, document.getElementById('root')!)


render(<App />, document.querySelector('#root')!)

Check warning on line 14 in apps/client/src/app/entry.tsx

View workflow job for this annotation

GitHub Actions / Linting project

Forbidden non-null assertion
2 changes: 1 addition & 1 deletion apps/client/src/app/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default as App } from './App'
export { default as App } from './app'
1 change: 0 additions & 1 deletion apps/client/src/app/providers/Router/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion apps/client/src/app/providers/Store/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion apps/client/src/app/providers/Theme/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,32 +1,29 @@
import {
createBrowserRouter
} from 'react-router-dom'
import { createBrowserRouter } from 'react-router-dom'

import { About } from '@/pages/About'
import { Main } from '@/pages/Main'
import { NotFound } from '@/pages/NotFound'
import { About } from '@/pages/about'
import { Main } from '@/pages/main'
import { NotFound } from '@/pages/not-found'

import { RoutePaths } from '$/client-shared'
import { Editor } from '$/editor'

const router = createBrowserRouter([
{
path: RoutePaths.MAIN,
element: <Main/>
element: <Main />
},
{
path: RoutePaths.EDITOR,
element: <Editor/>
element: <Editor />
},
{
path: RoutePaths.ABOUT,
element: <About/>
element: <About />
},
{
path: '*',
element: <NotFound/>
element: <NotFound />
}
])


export default router
1 change: 1 addition & 0 deletions apps/client/src/app/providers/router/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as RouterProvider } from './ui/router-provider'
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ const RouterProvider = () => {
return <Router router={router} />
}


export default RouterProvider
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ import { makeAutoObservable } from 'mobx'

import { EditorStore } from '$/editor'


class RootStore {
editor: EditorStore
editor: EditorStore

constructor() {
makeAutoObservable(this)
this.editor = new EditorStore()
}
constructor() {
makeAutoObservable(this)
this.editor = new EditorStore()
}
}


export default RootStore
1 change: 1 addition & 0 deletions apps/client/src/app/providers/store/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as StoreProvider } from './ui/store-provider'
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ export const StoreContext = createContext<RootStore>({} as RootStore)
export const StoreProvider = ({ children }: WithPreactChildren) => {
const root = new RootStore()

return <StoreContext.Provider value={root}>
{children}
</StoreContext.Provider>
return <StoreContext.Provider value={root}>{children}</StoreContext.Provider>
}

export default StoreProvider
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { theme } from 'antd'
import { ThemeConfig } from 'antd/es/config-provider'

import { DarkThemePalette } from '@/app/providers/Theme/config/themes'
import { DarkThemePalette } from '@/app/providers/theme/config/themes'

export const AntdConfig : ThemeConfig = {
export const AntdConfig: ThemeConfig = {
algorithm: theme.darkAlgorithm,
token: {
colorBgBase: DarkThemePalette.grey,
colorTextBase : DarkThemePalette.light,
colorTextBase: DarkThemePalette.light,
colorBorder: DarkThemePalette.lightGrey,
colorBgTextHover: DarkThemePalette.light,
colorBgTextActive: DarkThemePalette.light,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ export const DarkThemePalette = {
fz6: '16px',
fz7: '18px',
fz8: '19px',
fz9: '21px',
f10: '28px'
}
1 change: 1 addition & 0 deletions apps/client/src/app/providers/theme/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as ThemeProvider } from './ui/theme-provider'
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'styled-components'


declare module 'styled-components' {
export interface DefaultTheme {
black: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { ConfigProvider as AntdConfigProvider } from 'antd'
import { ThemeProvider as StyledThemeProvider } from 'styled-components'

import { AntdConfig } from '../config/antdConfig'
import { AntdConfig } from '../config/antd-config'
import { DarkThemePalette } from '../config/themes'

import { WithPreactChildren } from '$/client-shared'

const ThemeProvider = ({ children }: WithPreactChildren) => {
return <AntdConfigProvider theme={AntdConfig}>
<StyledThemeProvider theme={DarkThemePalette}>
{children}
</StyledThemeProvider>
</AntdConfigProvider>
return (
<AntdConfigProvider theme={AntdConfig}>
<StyledThemeProvider theme={DarkThemePalette}>
{children}
</StyledThemeProvider>
</AntdConfigProvider>
)
}


export default ThemeProvider
1 change: 0 additions & 1 deletion apps/client/src/app/styles/app.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { createGlobalStyle } from 'styled-components'

import { customScrollbar, font } from '$/styles'


export const GlobalStyles = createGlobalStyle`
body {
background: ${({ theme }) => theme.default};
Expand Down
1 change: 0 additions & 1 deletion apps/client/src/pages/About/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion apps/client/src/pages/Main/index.ts

This file was deleted.

14 changes: 0 additions & 14 deletions apps/client/src/pages/Main/ui/Main.tsx

This file was deleted.

1 change: 0 additions & 1 deletion apps/client/src/pages/NotFound/index.ts

This file was deleted.

1 change: 1 addition & 0 deletions apps/client/src/pages/about/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as About } from './ui/about'
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
const About = () => {
return <div>
about page
</div>
return <div>about page</div>
}


export default About
1 change: 1 addition & 0 deletions apps/client/src/pages/main/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as Main } from './ui/main'
16 changes: 16 additions & 0 deletions apps/client/src/pages/main/ui/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Link } from 'react-router-dom'

import { Page, RoutePaths } from '$/client-shared'

const Main = () => {
return (
<Page>
<div>
main <br />
<Link to={RoutePaths.EDITOR}>editor</Link>
</div>
</Page>
)
}

export default Main
1 change: 1 addition & 0 deletions apps/client/src/pages/not-found/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as NotFound } from './ui/not-found'
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@

const NotFound = () => {
return <div>
not found
</div>
return <div>not found</div>
}


export default NotFound
Loading