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

App version button #31

Merged
merged 3 commits into from
Feb 4, 2025
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
1 change: 1 addition & 0 deletions res/css/_components.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
@import "./structures/_MatrixChat.pcss";
@import "./structures/_MessagePanel.pcss";
@import "./structures/_NonUrgentToastContainer.pcss";
@import "./structures/_AppVersionButton.pcss";
@import "./structures/_QuickSettingsButton.pcss";
@import "./structures/_RightPanel.pcss";
@import "./structures/_RoomSearch.pcss";
Expand Down
35 changes: 35 additions & 0 deletions res/css/structures/_AppVersionButton.pcss
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;
}
40 changes: 40 additions & 0 deletions src/components/views/spaces/AppVersionButton.tsx
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;

3 changes: 3 additions & 0 deletions src/components/views/spaces/SpacePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import IconizedContextMenu, {
import SettingsStore from "../../../settings/SettingsStore";
import { SettingLevel } from "../../../settings/SettingLevel";
import UIStore from "../../../stores/UIStore";
import AppVersionButton from "./AppVersionButton";
import QuickSettingsButton from "./QuickSettingsButton";
import { useSettingValue } from "../../../hooks/useSettings";
import UserMenu from "../../structures/UserMenu";
Expand Down Expand Up @@ -424,6 +425,8 @@ const SpacePanel: React.FC = () => {
)}
</Droppable>

<AppVersionButton/>

<ThreadsActivityCentre displayButtonLabel={!isPanelCollapsed} />

<QuickSettingsButton isPanelCollapsed={isPanelCollapsed} />
Expand Down