Skip to content

Commit

Permalink
feat: add changes log
Browse files Browse the repository at this point in the history
  • Loading branch information
kangfenmao committed Jul 15, 2024
1 parent e90ef9d commit 74aa953
Show file tree
Hide file tree
Showing 13 changed files with 130 additions and 25 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
dist
out
.gitignore

1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ pnpm-lock.yaml
LICENSE.md
tsconfig.json
tsconfig.*.json
CHANGELOG*.md
1 change: 0 additions & 1 deletion src/renderer/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { PersistGate } from 'redux-persist/integration/react'
import Sidebar from './components/app/Sidebar'
import TopViewContainer from './components/TopView'
import { AntdThemeConfig, getAntdLocale } from './config/antd'
import './i18n'
import AppsPage from './pages/apps/AppsPage'
import HomePage from './pages/home/HomePage'
import SettingsPage from './pages/settings/SettingsPage'
Expand Down
7 changes: 0 additions & 7 deletions src/renderer/src/CHANGELOG.md

This file was deleted.

7 changes: 7 additions & 0 deletions src/renderer/src/assets/changelog/CHANGELOG.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# CHANGES LOG

### v0.2.1 - 2024-07-15

1. **Feature**: Add new feature for pausing message sending
2. **Fix**: Resolve incomplete translation issue upon language switch
3. **Build**: Support for macOS Intel architecture
8 changes: 8 additions & 0 deletions src/renderer/src/assets/changelog/CHANGELOG.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# 更新日志

### v0.2.1 - 2024-07-15

1. 【功能】新增消息暂停发送功能
2. 【修复】修复多语言切换不彻底问题
3. 【构建】支持 macOS Intel 架构

73 changes: 73 additions & 0 deletions src/renderer/src/assets/styles/changelog.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
$background-color: #121212;
$text-color: #ffffff;
$heading-color: #bb86fc;
$link-color: #3498db;
$code-background: #1e1e1e;
$code-color: #f0e7db;

.markdown {
body {
background-color: $background-color;
color: $text-color;
font-family: Arial, sans-serif;
padding: 20px;
}

h1,
h2,
h3,
h4,
h5,
h6 {
color: $heading-color;
}

h3 {
margin: 10px 0;
font-weight: 500;
font-family: Arial, sans-serif;
}

a {
color: $link-color;
text-decoration: none;

&:hover {
text-decoration: underline;
}
}

strong {
font-weight: bold;
}

pre {
background-color: $code-background;
padding: 10px;
border-radius: 5px;
overflow-x: auto;
}

code {
background-color: $code-background;
color: $code-color;
padding: 2px 4px;
border-radius: 3px;
}

blockquote {
border-left: 4px solid $heading-color;
padding-left: 10px;
margin-left: 0;
color: #b3b3b3;
}

ul,
ol {
padding-left: 30px;
}

li {
margin-bottom: 5px;
}
}
2 changes: 2 additions & 0 deletions src/renderer/src/hooks/useAppInitEffect.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { i18nInit } from '@renderer/i18n'
import LocalStorage from '@renderer/services/storage'
import { useAppDispatch } from '@renderer/store'
import { setAvatar } from '@renderer/store/runtime'
Expand All @@ -12,5 +13,6 @@ export function useAppInitEffect() {
const storedImage = await LocalStorage.getImage('avatar')
storedImage && dispatch(setAvatar(storedImage))
})
i18nInit()
}, [dispatch])
}
6 changes: 5 additions & 1 deletion src/renderer/src/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,15 @@ const resources = {

i18n.use(initReactI18next).init({
resources,
lng: store.getState().settings.language || 'en-US',
lng: localStorage.getItem('language') || 'en-US',
fallbackLng: 'en-US',
interpolation: {
escapeValue: false
}
})

export function i18nInit() {
i18n.changeLanguage(store.getState().settings.language || 'en-US')
}

export default i18n
1 change: 1 addition & 0 deletions src/renderer/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import ReactDOM from 'react-dom/client'
import App from './App'
import './assets/styles/index.scss'
import './init'
import './i18n'

ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<React.StrictMode>
Expand Down
17 changes: 2 additions & 15 deletions src/renderer/src/pages/settings/AboutSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import styled from 'styled-components'
import Logo from '@renderer/assets/images/logo.png'
import { runAsyncFunction } from '@renderer/utils'
import { useTranslation } from 'react-i18next'
import Markdown from 'react-markdown'
import changelogs from '@renderer/CHANGELOG.md?raw'
import Changelog from './components/Changelog'

const AboutSettings: FC = () => {
const [version, setVersion] = useState('')
Expand All @@ -25,9 +24,7 @@ const AboutSettings: FC = () => {
Cherry Studio <Version>(v{version})</Version>
</Title>
<Description>{t('settings.about.description')}</Description>
<ChangeLog>
<Markdown className="markdown">{changelogs}</Markdown>
</ChangeLog>
<Changelog />
</Container>
)
}
Expand Down Expand Up @@ -60,14 +57,4 @@ const Description = styled.div`
text-align: center;
`

const ChangeLog = styled.div`
font-size: 14px;
color: var(--color-text-2);
background-color: var(--color-background-soft);
margin-top: 40px;
padding: 20px;
border-radius: 5px;
width: 800px;
`

export default AboutSettings
2 changes: 1 addition & 1 deletion src/renderer/src/pages/settings/GeneralSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const GeneralSettings: FC = () => {
const onSelectLanguage = (value: string) => {
dispatch(setLanguage(value))
i18next.changeLanguage(value)
setTimeout(() => window.location.reload(), 500)
localStorage.setItem('language', value)
}

return (
Expand Down
29 changes: 29 additions & 0 deletions src/renderer/src/pages/settings/components/Changelog.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import changelogEn from '@renderer/assets/changelog/CHANGELOG.en.md?raw'
import changelogZh from '@renderer/assets/changelog/CHANGELOG.zh.md?raw'
import i18next from 'i18next'
import { FC } from 'react'
import Markdown from 'react-markdown'
import styled from 'styled-components'
import styles from '@renderer/assets/styles/changelog.module.scss'

const Changelog: FC = () => {
const language = i18next.language
const changelog = language === 'zh-CN' ? changelogZh : changelogEn

return (
<Container>
<Markdown className={styles.markdown}>{changelog}</Markdown>
</Container>
)
}

const Container = styled.div`
font-size: 14px;
background-color: var(--color-background-soft);
margin-top: 40px;
padding: 20px;
border-radius: 5px;
width: 650px;
`

export default Changelog

0 comments on commit 74aa953

Please sign in to comment.