-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
179 additions
and
34 deletions.
There are no files selected for viewing
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,56 @@ | ||
import { defineConfig } from 'dumi'; | ||
import path from 'node:path'; | ||
|
||
import { homepage } from '../package.json'; | ||
|
||
const isWin = process.platform === 'win32'; | ||
|
||
const isProd = process.env.NODE_ENV === 'production'; | ||
|
||
const themeConfig = { | ||
actions: [ | ||
{ | ||
link: homepage, | ||
openExternal: true, | ||
text: 'Github', | ||
}, | ||
{ | ||
link: 'https://github.com/lobehub/lobe-chat', | ||
text: 'Try it on LobeChat', | ||
type: 'primary', | ||
}, | ||
], | ||
footer: 'Made with 🤯 by LobeHub', | ||
name: 'Realtime Weather', | ||
socialLinks: { | ||
discord: 'https://discord.gg/AYFPHvv2jT', | ||
github: homepage, | ||
}, | ||
}; | ||
|
||
export default defineConfig({ | ||
alias: { | ||
'@': path.join(__dirname, '../src'), | ||
}, | ||
base: isProd ? '/docs/' : '/', | ||
extraBabelPlugins: ['babel-plugin-antd-style'], | ||
favicons: [ | ||
'https://registry.npmmirror.com/@lobehub/assets-emoji/1.3.0/files/assets/package.webp', | ||
], | ||
mfsu: isWin ? undefined : {}, | ||
npmClient: 'pnpm', | ||
outputPath: '../public/docs', | ||
|
||
publicPath: isProd ? '/docs/' : '/', | ||
// ssr: isProduction ? {} : false, | ||
styles: [ | ||
`html, body { background: transparent; } | ||
@media (prefers-color-scheme: dark) { | ||
html, body { background: #000; } | ||
}`, | ||
], | ||
|
||
themeConfig, | ||
title: 'RealTime Weather - Lobe Chat Plugin', | ||
}); |
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,9 @@ | ||
--- | ||
title: Changelog | ||
description: New updates and improvements to @lobehub/chat-plugin-realtime-weather | ||
nav: | ||
title: Changelog | ||
order: 999 | ||
--- | ||
|
||
<embed src="../../CHANGELOG.md"></embed> |
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,7 @@ | ||
import { manClothes } from '@/data'; | ||
|
||
export const data = { | ||
clothes: manClothes['happy'], | ||
mood: 'happy', | ||
today: Date.now(), | ||
}; |
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,7 @@ | ||
import Render from '@/components/Render'; | ||
|
||
import { data } from './data'; | ||
|
||
export default () => { | ||
return <Render {...data} />; | ||
}; |
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,7 @@ | ||
--- | ||
hero: | ||
title: Project <b>Template</b> | ||
description: This is the plugin template for LobeChat plugin development | ||
--- | ||
|
||
<code src="./demo.tsx" inline></code> |
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 @@ | ||
{ | ||
"name": "docs", | ||
"version": "0.0.0", | ||
"private": true, | ||
"scripts": { | ||
"build": "dumi build", | ||
"dev": "dumi dev" | ||
}, | ||
"devDependencies": { | ||
"babel-plugin-antd-style": "^1", | ||
"dumi": "^2", | ||
"dumi-theme-lobehub": "latest" | ||
} | ||
} |
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,29 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "CommonJS", | ||
"target": "ES5", | ||
"lib": ["dom", "dom.iterable", "esnext"], | ||
"sourceMap": true, | ||
"skipDefaultLibCheck": true, | ||
"jsx": "react-jsx", | ||
"baseUrl": ".", | ||
"allowSyntheticDefaultImports": true, | ||
"moduleResolution": "node", | ||
"forceConsistentCasingInFileNames": true, | ||
"noImplicitReturns": true, | ||
"noUnusedLocals": true, | ||
"resolveJsonModule": true, | ||
"skipLibCheck": true, | ||
"strict": true, | ||
"paths": { | ||
"@@/*": ["./dumi/tmp/*"], | ||
"@/*": ["../src/*"] | ||
}, | ||
"noEmit": true, | ||
"incremental": true, | ||
"esModuleInterop": true, | ||
"isolatedModules": true | ||
}, | ||
"exclude": ["node_modules"], | ||
"include": [".", ".dumi/**/*", ".dumirc.ts", "../src"] | ||
} |
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,3 @@ | ||
packages: | ||
- 'docs' | ||
- . |
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,38 @@ | ||
import { Card } from 'antd'; | ||
import { createStyles } from 'antd-style'; | ||
import dayjs from 'dayjs'; | ||
import { memo } from 'react'; | ||
import { Flexbox } from 'react-layout-kit'; | ||
|
||
import { ResponseData } from '@/type'; | ||
|
||
const useStyles = createStyles(({ css, token }) => ({ | ||
date: css` | ||
color: ${token.colorTextQuaternary}; | ||
`, | ||
})); | ||
|
||
const Render = memo<Partial<ResponseData>>(({ mood, clothes, today }) => { | ||
const { styles } = useStyles(); | ||
|
||
return ( | ||
<Flexbox gap={24}> | ||
<Flexbox distribution={'space-between'} horizontal> | ||
🌟心情:{mood} | ||
<span className={styles.date}>{dayjs(today).format('YYYY/MM/DD')}</span> | ||
</Flexbox> | ||
<Flexbox gap={8}> | ||
推荐衣物 | ||
<Flexbox gap={12} horizontal> | ||
{clothes?.map((item) => ( | ||
<Card key={item.name} size={'small'} title={item.name}> | ||
{item.description} | ||
</Card> | ||
))} | ||
</Flexbox> | ||
</Flexbox> | ||
</Flexbox> | ||
); | ||
}); | ||
|
||
export default Render; |
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 |
---|---|---|
@@ -1,46 +1,19 @@ | ||
import { fetchPluginMessage } from '@lobehub/chat-plugin-sdk/client'; | ||
import { Card } from 'antd'; | ||
import { createStyles } from 'antd-style'; | ||
import dayjs from 'dayjs'; | ||
import { memo, useEffect, useState } from 'react'; | ||
import { Flexbox } from 'react-layout-kit'; | ||
|
||
import Data from '@/components/Render'; | ||
import { ResponseData } from '@/type'; | ||
|
||
const useStyles = createStyles(({ css, token }) => ({ | ||
date: css` | ||
color: ${token.colorTextQuaternary}; | ||
`, | ||
})); | ||
|
||
const Render = memo(() => { | ||
const [data, setData] = useState<ResponseData>(); | ||
const { styles } = useStyles(); | ||
|
||
useEffect(() => { | ||
fetchPluginMessage().then((e: ResponseData) => { | ||
setData(e); | ||
}); | ||
}, []); | ||
|
||
return ( | ||
<Flexbox gap={24}> | ||
<Flexbox distribution={'space-between'} horizontal> | ||
🌟心情:{data?.mood} | ||
<span className={styles.date}>{dayjs(data?.today).format('YYYY/MM/DD')}</span> | ||
</Flexbox> | ||
<Flexbox gap={8}> | ||
推荐衣物 | ||
<Flexbox gap={12} horizontal> | ||
{data?.clothes?.map((item) => ( | ||
<Card key={item.name} size={'small'} title={item.name}> | ||
{item.description} | ||
</Card> | ||
))} | ||
</Flexbox> | ||
</Flexbox> | ||
</Flexbox> | ||
); | ||
return <Data {...data}></Data>; | ||
}); | ||
|
||
export default Render; |