-
Notifications
You must be signed in to change notification settings - Fork 52
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
4 changed files
with
58 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
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,54 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import { Dropdown, DropdownButton } from 'react-bootstrap'; | ||
|
||
import UIStore from 'src/stores/alt/stores/UIStore'; | ||
|
||
function ExternalItem({ title, href }) { | ||
return ( | ||
<Dropdown.Item | ||
className="d-flex gap-3 align-items-baseline justify-content-between" | ||
href={href} | ||
target="_blank" | ||
> | ||
{title} | ||
<i className="fa fa-external-link" /> | ||
</Dropdown.Item> | ||
); | ||
} | ||
|
||
export default function SupportMenuButton() { | ||
const [version, setVersion] = useState({}); | ||
const onUiStoreChange = ({ version }) => setVersion(version); | ||
useEffect(() => { | ||
UIStore.listen(onUiStoreChange); | ||
onUiStoreChange(UIStore.getState()); | ||
return () => UIStore.unlisten(onUiStoreChange); | ||
}, []); | ||
const hasVersions = version && Object.keys(version).length > 1; | ||
|
||
return ( | ||
<DropdownButton title="Info & Support" variant="light"> | ||
<ExternalItem title="Chemotion.net" href="https://www.chemotion.net" /> | ||
<ExternalItem title="Chemotion-Repository.net" href="https://www.chemotion-repository.net" /> | ||
<Dropdown.Divider /> | ||
<ExternalItem title="Search documentation" href="https://chemotion.net/search" /> | ||
<ExternalItem title="Helpdesk - Contact Us" href="https://chemotion.net/helpdesk" /> | ||
<ExternalItem title="Report an issue on Github" href="https://github.com/ComPlat/chemotion_ELN/issues" /> | ||
{hasVersions && ( | ||
<> | ||
<Dropdown.Divider /> | ||
<Dropdown.ItemText className="d-flex flex-column text-muted"> | ||
{Object.entries(version).map(([k, v]) => ( | ||
<span key={k} className="d-flex justify-content-between"> | ||
<span>{k}:</span> | ||
<span style={{ userSelect: 'text' }}> | ||
{k == 'version' ? v : v.substring(0, 8)} | ||
</span> | ||
</span> | ||
))} | ||
</Dropdown.ItemText> | ||
</> | ||
)} | ||
</DropdownButton> | ||
); | ||
} |
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