forked from element-hq/element-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from elecordapp/app-version-button
App version button
- Loading branch information
Showing
4 changed files
with
79 additions
and
0 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,35 @@ | ||
/* | ||
Copyright 2025 hazzuk. | ||
SPDX-License-Identifier: AGPL-3.0-only | ||
Please see LICENSE files in the repository root for full details. | ||
*/ | ||
|
||
.mx_AppVersionButton { | ||
border-radius: 10px; | ||
background-color: #2c2f32bd; | ||
width: 75%; | ||
align-self: center; | ||
cursor: pointer; | ||
} | ||
|
||
.mx_AppVersionButton_title { | ||
text-align: center; | ||
color: #62a9df70; | ||
font-size: small; | ||
margin: 3px 0 0px 0px; | ||
font-weight: bold; | ||
} | ||
|
||
.mx_AppVersionButton_dev { | ||
color: #df946270 !important; | ||
} | ||
|
||
.mx_AppVersionButton_number { | ||
color: #727374; | ||
text-align: center; | ||
font-size: smaller; | ||
margin: 0 0 3px 0; | ||
overflow: hidden; | ||
text-wrap-mode: nowrap; | ||
} |
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,40 @@ | ||
/* | ||
Copyright 2025 hazzuk. | ||
SPDX-License-Identifier: AGPL-3.0-only | ||
Please see LICENSE files in the repository root for full details. | ||
*/ | ||
|
||
import React, { useState, useEffect } from "react"; | ||
import classNames from "classnames"; | ||
|
||
const AppVersionButton: React.FC = () => { | ||
const [version, setVersion] = useState<string | null>(null); | ||
|
||
useEffect(() => { | ||
fetch("version") | ||
.then(r => r.text()) | ||
.then(v => setVersion(v)); | ||
}, []); | ||
|
||
return ( | ||
<a | ||
href="https://github.com/elecordapp/elecord-web/releases" | ||
target="_blank" | ||
rel="noreferrer noopener" | ||
className="mx_AppVersionButton" | ||
> | ||
<p | ||
className={classNames("mx_AppVersionButton_title", { | ||
"mx_AppVersionButton_dev": version && !version.includes(".") | ||
})} | ||
> | ||
{version && !version.includes(".") ? "DEV" : "BETA"} | ||
</p> | ||
<p className="mx_AppVersionButton_number">{version || "..."}</p> | ||
</a> | ||
); | ||
}; | ||
|
||
export default AppVersionButton; | ||
|
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