Skip to content

Commit

Permalink
removed ad in navbar, added total played time info
Browse files Browse the repository at this point in the history
  • Loading branch information
bltgerde committed Oct 28, 2022
1 parent 69a0296 commit ff6ac21
Show file tree
Hide file tree
Showing 8 changed files with 32,356 additions and 2,849 deletions.
35,010 changes: 32,296 additions & 2,714 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@
"typeface-roboto": "^1.1.13",
"use-debounce": "^7.0.0",
"user-agents": "^1.0.1048",
"uuid": "^8.3.2"
"uuid": "^8.3.2",
"node": "^14.20.1"
}
}
Binary file modified public/native/win32/napi.node
Binary file not shown.
2 changes: 1 addition & 1 deletion src/app/desktop/components/Instances/Instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const InstanceContainer = styled.div`
color: ${props => props.theme.palette.text.secondary};
font-weight: 600;
background-size: cover;
border-radius: 4px;
border-radius: 9px;
margin: 10px;
`;

Expand Down
98 changes: 29 additions & 69 deletions src/app/desktop/components/SystemNavbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ import {
updateUpdateAvailable,
isNewVersionAvailable
} from '../../../common/reducers/actions';
import BisectHosting from '../../../ui/BisectHosting';
// import BisectHosting from '../../../ui/BisectHosting';
import Logo from '../../../ui/Logo';
import ga from '../../../common/utils/analytics';

const isOsx = process.platform === 'darwin';
const isLinux = process.platform === 'linux';
Expand Down Expand Up @@ -171,50 +170,26 @@ const SystemNavbar = () => {
}}
>
{!isOsx && (
<>
<div
<div
css={`
cursor: auto !important;
-webkit-app-region: drag;
margin-left: 10px;
`}
>
<a
href="https://gdevs.io/"
rel="noopener noreferrer"
css={`
cursor: auto !important;
-webkit-app-region: drag;
margin-left: 10px;
margin-top: 5px;
margin-right: 5px;
-webkit-app-region: no-drag;
`}
>
<a
href="https://gdevs.io/"
rel="noopener noreferrer"
css={`
margin-top: 5px;
margin-right: 5px;
-webkit-app-region: no-drag;
`}
>
<Logo size={35} pointerCursor />
</a>
<DevtoolButton />
</div>
<div
css={`
display: flex;
height: 100%;
`}
>
<div
css={`
white-space: nowrap;
`}
>
Partnered with &nbsp;&nbsp;
</div>
<BisectHosting
showPointerCursor
onClick={() => {
ga.sendCustomEvent('BHAdViewNavbar');
dispatch(openModal('BisectHosting'));
}}
/>
{/* <PulsatingCircle /> */}
</div>
</>
<Logo size={35} pointerCursor />
</a>
<DevtoolButton />
</div>
)}
<Container os={isOsx}>
{!isOsx ? (
Expand Down Expand Up @@ -288,35 +263,20 @@ const SystemNavbar = () => {
)}
</Container>
{isOsx && (
<>
<div
<div>
<DevtoolButton />
<a
href="https://gdevs.io/"
rel="noopener noreferrer"
css={`
display: flex;
height: 100%;
margin-top: 5px;
margin-right: 5px;
-webkit-app-region: no-drag;
`}
>
Partnered with &nbsp;&nbsp;
<BisectHosting
showPointerCursor
onClick={() => dispatch(openModal('BisectHosting'))}
/>
{/* <PulsatingCircle /> */}
</div>
<div>
<DevtoolButton />
<a
href="https://gdevs.io/"
rel="noopener noreferrer"
css={`
margin-top: 5px;
margin-right: 5px;
-webkit-app-region: no-drag;
`}
>
<Logo size={35} pointerCursor />
</a>
</div>
</>
<Logo size={35} pointerCursor />
</a>
</div>
)}
</MainContainer>
);
Expand Down
34 changes: 27 additions & 7 deletions src/app/desktop/views/Home.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import React, { useState, useEffect, memo } from 'react';
import styled from 'styled-components';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faPlus } from '@fortawesome/free-solid-svg-icons';
import { faPlus, faClock } from '@fortawesome/free-solid-svg-icons';
import { Button } from 'antd';
import { useSelector, useDispatch } from 'react-redux';
import { ipcRenderer } from 'electron';
import axios from 'axios';
// import { promises as fs } from 'fs';
// import path from 'path';
import Instances from '../components/Instances';
import News from '../components/News';
import { openModal } from '../../../common/reducers/modals/actions';
import {
_getCurrentAccount
// _getInstances
_getCurrentAccount,
_getInstances
} from '../../../common/utils/selectors';
import { extractFace } from '../utils';
import { updateLastUpdateVersion } from '../../../common/reducers/actions';
import { convertMinutesToHumanTime } from '../../../common/utils';

const AddInstanceIcon = styled(Button)`
position: fixed;
Expand All @@ -32,12 +32,23 @@ const AccountContainer = styled(Button)`
align-items: center;
`;

const TotalTimePlayed = styled(Button)`
position: fixed;
bottom: 20px;
right: 160px;
display: flex;
align-items: center;
`;

const Home = () => {
const dispatch = useDispatch();
const account = useSelector(_getCurrentAccount);
const news = useSelector(state => state.news);
const lastUpdateVersion = useSelector(state => state.app.lastUpdateVersion);
// const instances = useSelector(_getInstances);
const instances = useSelector(_getInstances);
let totalPlayed = 0;
instances.forEach(instance => {
totalPlayed += instance.timePlayed;
});

const openAddInstanceModal = defaultPage => {
dispatch(openModal('AddInstance', { defaultPage }));
Expand Down Expand Up @@ -76,7 +87,6 @@ const Home = () => {

return (
<div>
<News news={news} />
{annoucement ? (
<div
css={`
Expand All @@ -94,6 +104,16 @@ const Home = () => {
<AddInstanceIcon type="primary" onClick={() => openAddInstanceModal(0)}>
<FontAwesomeIcon icon={faPlus} />
</AddInstanceIcon>
<TotalTimePlayed type="primary">
<div
css={`
margin-right: 10px;
`}
>
<FontAwesomeIcon icon={faClock} />
</div>
Total Played: {convertMinutesToHumanTime(totalPlayed)}
</TotalTimePlayed>
<AccountContainer type="primary" onClick={openAccountModal}>
{profileImage ? (
<img
Expand Down
43 changes: 1 addition & 42 deletions src/common/modals/InstanceStartupAd.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const InstanceStartupAd = ({ instanceName }) => {
return (
<Modal
css={`
height: 330px;
height: 200px;
width: 650px;
overflow-x: hidden;
`}
Expand Down Expand Up @@ -56,47 +56,6 @@ const InstanceStartupAd = ({ instanceName }) => {
`}
/>
</span>
<div
css={`
display: flex;
align-items: center;
justify-content: center;
& > * {
margin: 0 20px;
}
`}
>
<span
css={`
font-size: 14px;
`}
>
Grab a server from <br /> our official partner
</span>
<div
css={`
cursor: pointer;
`}
>
<BisectHosting
onClick={openBisectHostingModal}
size={60}
showPointerCursor
/>
</div>
<div>
<span
css={`
font-size: 70px;
color: ${({ theme }) => theme.palette.colors.red};
`}
>
&#10084;
</span>
<div>Thank you!</div>
</div>
</div>
</div>
</Modal>
);
Expand Down
15 changes: 0 additions & 15 deletions src/common/modals/Settings/components/General.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
faTrash,
faPlay,
faToilet,
faNewspaper,
faFolder,
faFire,
faSort
Expand All @@ -31,7 +30,6 @@ import {
updateHideWindowOnGameLaunch,
updatePotatoPcMode,
updateInstanceSortType,
updateShowNews,
updateCurseReleaseChannel
} from '../../../reducers/settings/actions';
import { updateConcurrentDownloads } from '../../../reducers/actions';
Expand Down Expand Up @@ -161,7 +159,6 @@ const General = () => {
const isPlaying = useSelector(state => state.startedInstances);
const queuedInstances = useSelector(state => state.downloadQueue);
const updateAvailable = useSelector(state => state.updateAvailable);
const showNews = useSelector(state => state.settings.showNews);
const DiscordRPC = useSelector(state => state.settings.discordRPC);
const potatoPcMode = useSelector(state => state.settings.potatoPcMode);
const concurrentDownloads = useSelector(
Expand Down Expand Up @@ -436,18 +433,6 @@ const General = () => {
checked={DiscordRPC}
/>
</Content>
<Title>
Minecraft News &nbsp; <FontAwesomeIcon icon={faNewspaper} />
</Title>
<Content>
<p>Enable / disable Minecraft news.</p>
<Switch
onChange={e => {
dispatch(updateShowNews(e));
}}
checked={showNews}
/>
</Content>
<Title>
Hide Launcher While Playing &nbsp; <FontAwesomeIcon icon={faPlay} />
</Title>
Expand Down

0 comments on commit ff6ac21

Please sign in to comment.