-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: integrate
ReleaseVersion
component into HelpButton
- Added `ReleaseVersion` component: - Displays the current CLI version, including: - Released version (e.g., `v0.0.11 (2024-12-19)`). - Unreleased version with short Git hash (e.g., `v0.0.11 + 0d6169a (2024-12-19)`). - Fetches version information from the `CliVersionProvider`. - Updated `App.tsx`: - Initialized `cliVersion` using `import.meta.env.VITE_CLI_VERSION_*` environment variables. - Wrapped `ERDRenderer` with `CliVersionProvider` to provide version context globally.
- Loading branch information
1 parent
6fdbbdd
commit 4027944
Showing
6 changed files
with
71 additions
and
2 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
12 changes: 12 additions & 0 deletions
12
.../packages/erd-core/src/components/ERDRenderer/AppBar/HelpButton/ReleaseVersion.module.css
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,12 @@ | ||
.cliVersion { | ||
padding: var(--spacing-2); | ||
} | ||
|
||
.cliVersionInner { | ||
border-radius: var(--border-radius-full); | ||
background: var(--pane-muted-background); | ||
padding: var(--spacing-1) var(--spacing-2); | ||
color: var(--global-mute-text); | ||
font-family: var(--code-font); | ||
font-size: var(--font-size-1); | ||
} |
32 changes: 32 additions & 0 deletions
32
frontend/packages/erd-core/src/components/ERDRenderer/AppBar/HelpButton/ReleaseVersion.tsx
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,32 @@ | ||
import { CliVersionProvider, useCliVersion } from '@/providers' | ||
import type { FC } from 'react' | ||
import styles from './ReleaseVersion.module.css' | ||
|
||
export const ReleaseVersion: FC = () => { | ||
const { cliVersion } = useCliVersion() | ||
|
||
// Example output for cliVersion: | ||
// - Released version: | ||
// v0.0.11 (2024-12-19) | ||
// - Unreleased version: | ||
// v0.0.11 + 0d6169a (2024-12-19) | ||
// | ||
// Explanation: | ||
// - "Released version" means the current Git hash matches a tagged release. | ||
// - "Unreleased version" includes a short Git hash prefix to indicate changes since the last release. | ||
return ( | ||
<CliVersionProvider cliVersion={cliVersion}> | ||
<div className={styles.cliVersion}> | ||
<div className={styles.cliVersionInner}> | ||
<span>{`v${cliVersion.version}`}</span> | ||
<span> | ||
{' '} | ||
{cliVersion.isReleasedGitHash || | ||
`+ ${cliVersion.gitHash.slice(0, 7)} `} | ||
</span> | ||
<span>{cliVersion.date.length > 0 && ` (${cliVersion.date})`}</span> | ||
</div> | ||
</div> | ||
</CliVersionProvider> | ||
) | ||
} |
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,2 +1,4 @@ | ||
export * from './components' | ||
export * from './providers' | ||
export * from './schemas' | ||
export * from './stores' |
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 @@ | ||
export * from './cliVersion' | ||
export * from './queryParam' | ||
export * from './showMode' |