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

UI tweaks #61

Merged
merged 2 commits into from
Dec 7, 2024
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
Binary file modified src/assets/snow-dark.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/snow.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion src/components/GameSidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useLocation, Link as RouterLink } from "react-router-dom";
import User from "./User";
import Subheading from "./Subheading";
import useMoment from "../hooks/useMoment";
import { formatTime } from "../util";
import { formatTime, modes, capitalizeFirst } from "../util";

const useStyles = makeStyles((theme) => ({
sidebar: {
Expand Down Expand Up @@ -50,6 +50,11 @@ function GameSidebar({ game, scores, leaderboard, endedAt }) {

return (
<Paper className={classes.sidebar}>
<Subheading>
{modes[game.mode].name}{" "}
<span style={{ opacity: 0.4 }}>[{capitalizeFirst(game.access)}]</span>
</Subheading>
<Divider style={{ margin: "4px 0" }} />
{/* Timer */}
<div className={classes.timer} style={{ marginTop: 6 }}>
<AlarmIcon className={classes.alarm} fontSize="large" />
Expand Down
22 changes: 13 additions & 9 deletions src/components/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import Brightness4Icon from "@material-ui/icons/Brightness4";
import Brightness7Icon from "@material-ui/icons/Brightness7";
import VolumeOffIcon from "@material-ui/icons/VolumeOff";
import VolumeUpIcon from "@material-ui/icons/VolumeUp";
import { makeStyles } from "@material-ui/core/styles";

import firebase from "../firebase";
import { UserContext, SettingsContext } from "../context";
Expand All @@ -27,6 +28,16 @@ import KeyboardLayoutDialog from "./KeyboardLayoutDialog";
import AccountOptionsDialog from "./AccountOptionsDialog";
import hatImage from "../assets/hat.png";

const useStyles = makeStyles((theme) => ({
treeIcon: {
verticalAlign: "top",
fontSize: "0.9em",
[theme.breakpoints.up("md")]: {
marginLeft: "-0.2em",
},
},
}));

function Navbar({
themeType,
handleChangeTheme,
Expand All @@ -35,6 +46,7 @@ function Navbar({
}) {
const user = useContext(UserContext);
const settings = useContext(SettingsContext);
const classes = useStyles();
const [anchorEl, setAnchorEl] = useState(null);
const [changeName, setChangeName] = useState(false);
const [changeUserColor, setChangeUserColor] = useState(false);
Expand Down Expand Up @@ -88,15 +100,7 @@ function Navbar({
<InternalLink underline="none" color="inherit" to="/">
Set with Friends
</InternalLink>
<span
style={{
verticalAlign: "text-bottom",
fontSize: "smaller",
marginLeft: "-0.2em",
}}
>
🎄
</span>
<span className={classes.treeIcon}>🎄</span>
</Typography>
<Typography
variant="subtitle1"
Expand Down
8 changes: 2 additions & 6 deletions src/pages/RoomPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import Chat from "../components/Chat";
import firebase from "../firebase";
import { UserContext } from "../context";
import GameSettings from "../components/GameSettings";
import { capitalizeFirst } from "../util";

const useStyles = makeStyles((theme) => ({
subpanel: {
Expand All @@ -44,11 +45,6 @@ const useStyles = makeStyles((theme) => ({
height: 400,
padding: 8,
},
modeSelection: {
display: "flex",
flexDirection: "row",
justifyContent: "space-around",
},
}));

function RoomPage({ match, location }) {
Expand Down Expand Up @@ -151,7 +147,7 @@ function RoomPage({ match, location }) {
}
>
<span style={{ opacity: 0.4 }}>
[{game.access === "public" ? "Public" : "Private"}]
[{capitalizeFirst(game.access)}]
</span>
</Tooltip>
</Typography>
Expand Down
2 changes: 0 additions & 2 deletions src/themes.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export const darkTheme = createTheme({
"@global": {
body: {
backgroundImage: `url("${snowDarkImage}")`,
backgroundSize: "25%",
},
},
},
Expand Down Expand Up @@ -107,7 +106,6 @@ export const lightTheme = createTheme({
"@global": {
body: {
backgroundImage: `url("${snowLightImage}")`,
backgroundSize: "25%",
},
},
},
Expand Down
4 changes: 4 additions & 0 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,7 @@ export function hasHint(game) {
export function censorText(text) {
return censor.applyTo(text, badWords.getAllMatches(text));
}

export function capitalizeFirst(text) {
return text.charAt(0).toUpperCase() + text.slice(1);
}
Loading