-
Notifications
You must be signed in to change notification settings - Fork 18
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 #131 from Jam3/fix-app-build
fix: add build admin
- Loading branch information
Showing
8 changed files
with
374 additions
and
209 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
Large diffs are not rendered by default.
Oops, something went wrong.
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 'shared'; | ||
|
||
.AppAdmin { | ||
position: fixed; | ||
bottom: 0; | ||
right: 0; | ||
width: px(180); | ||
display: flex; | ||
flex-direction: column; | ||
font: 11px 'Lucida Grande', sans-serif; | ||
color: $white; | ||
background-color: $black; | ||
z-index: 10000000; | ||
|
||
button { | ||
width: 100%; | ||
height: px(20); | ||
margin: 0; | ||
padding: 0; | ||
border: none; | ||
overflow: visible; | ||
background: transparent; | ||
color: inherit; | ||
font: inherit; | ||
|
||
line-height: normal; | ||
|
||
-webkit-font-smoothing: inherit; | ||
-moz-osx-font-smoothing: inherit; | ||
-webkit-appearance: none; | ||
} | ||
|
||
section.adminSection { | ||
text-align: left; | ||
padding: 0 px(10); | ||
border-top: 1px solid #303030; | ||
|
||
&.closed { | ||
.adminSectionTitle { | ||
span { | ||
} | ||
} | ||
} | ||
|
||
.adminSectionTitle { | ||
font-size: inherit; | ||
padding: px(7) 0; | ||
} | ||
|
||
ul li { | ||
padding: px(7) 0 px(7) px(10); | ||
} | ||
} | ||
} |
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,70 @@ | ||
import { memo, useState } from 'react'; | ||
import { os, browser, device } from '@jam3/detect'; | ||
import { useWindowSize } from 'react-use'; | ||
import classnames from 'classnames'; | ||
|
||
import styles from './AppAdmin.module.scss'; | ||
|
||
function AppAdmin() { | ||
const [removed, setRemoved] = useState(false); | ||
const [open, setOpen] = useState(true); | ||
const [deviceOpen, deviceSetOpen] = useState(true); | ||
const [buildOpen, buildSetOpen] = useState(true); | ||
const { width, height } = useWindowSize(); | ||
|
||
return !removed ? ( | ||
<div className={styles.AppAdmin}> | ||
<button onClick={() => setOpen(!open)}>{open ? 'Close ' : 'Open '} Admin</button> | ||
{open && ( | ||
<> | ||
<section className={styles.adminSection}> | ||
<h3 className={styles.adminSectionTitle} onClick={() => setRemoved(true)}> | ||
Remove Admin from DOM | ||
</h3> | ||
</section> | ||
<section className={classnames(styles.adminSection, { [styles.closed]: deviceOpen })}> | ||
<h3 className={styles.adminSectionTitle} onClick={() => deviceSetOpen(!deviceOpen)}> | ||
Device info | ||
</h3> | ||
{deviceOpen && ( | ||
<ul> | ||
<li> | ||
{device.type} ({width} x {height}) | ||
</li> | ||
<li> | ||
{os.name} {os.version} | ||
</li> | ||
<li> | ||
{browser.name} {browser.version} | ||
</li> | ||
</ul> | ||
)} | ||
</section> | ||
<section className={classnames(styles.adminSection, { [styles.closed]: buildOpen })}> | ||
<h3 className={styles.adminSectionTitle} onClick={() => buildSetOpen(!buildOpen)}> | ||
Build info | ||
</h3> | ||
{buildOpen && ( | ||
<ul> | ||
<li> | ||
{process.env.NEXT_PUBLIC_PR_NUMBER}.{process.env.NEXT_PUBLIC_COMMIT_COUNT} | ||
</li> | ||
<li>{process.env.NEXT_PUBLIC_COMMIT_ID?.slice(0, 6)}</li> | ||
<li>{process.env.NEXT_PUBLIC_BUILD_TIME}</li> | ||
{process.env.NEXT_PUBLIC_PULL_REQUEST && ( | ||
<li> | ||
<a href={process.env.NEXT_PUBLIC_PULL_REQUEST} rel="noopener noreferrer" target="_blank"> | ||
PR link | ||
</a> | ||
</li> | ||
)} | ||
</ul> | ||
)} | ||
</section> | ||
</> | ||
)} | ||
</div> | ||
) : null; | ||
} | ||
|
||
export default memo(AppAdmin); |
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