-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
19f8c9f
commit 8908822
Showing
7 changed files
with
169 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import type { ObjectId } from 'mongodb' | ||
|
||
// TODO remove, move to PlayerModel | ||
export interface PlayerPreferencesModel { | ||
player: ObjectId | ||
preferences: { | ||
soundVolume?: string | ||
} | ||
} |
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,11 @@ | ||
import { makeIcon } from './make-icon' | ||
|
||
export const IconVolume = makeIcon( | ||
'volume', | ||
<> | ||
<path stroke="none" d="M0 0h24v24H0z" fill="none" /> | ||
<path d="M15 8a5 5 0 0 1 0 8" /> | ||
<path d="M17.7 5a9 9 0 0 1 0 14" /> | ||
<path d="M6 15h-2a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h2l3.5 -4.5a.8 .8 0 0 1 1.5 .5v14a.8 .8 0 0 1 -1.5 .5l-3.5 -4.5" /> | ||
</>, | ||
) |
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
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,50 @@ | ||
import { Layout } from '../../../html/layout' | ||
import type { User } from '../../../auth/types/user' | ||
import { NavigationBar } from '../../../html/components/navigation-bar' | ||
import { Page } from '../../../html/components/page' | ||
import { IconVolume } from '../../../html/components/icons' | ||
import { collections } from '../../../database/collections' | ||
|
||
export async function PlayerSettingsPage(props: { user: User }) { | ||
const player = await collections.players.findOne({ steamId: props.user.player.steamId }) | ||
const preferences = await collections.playerPreferences.findOne({ player: player!._id }) | ||
const soundVolume = preferences?.preferences.soundVolume ?? '1.0' | ||
|
||
return ( | ||
<Layout title="Settings"> | ||
<NavigationBar user={props.user} /> | ||
<Page> | ||
<div class="container mx-auto"> | ||
<form action="" method="post"> | ||
<div class="bg-abru-dark-25 rounded-lg flex-1 p-[24px] text-abru-light-75 font-normal flex flex-col gap-4"> | ||
<h4 class="font-bold text-[24px]">Preferences</h4> | ||
|
||
<div class="flex flex-col"> | ||
<label for="notification-sound-volume">Notification sound volume</label> | ||
<div class="flex flex-row items-center gap-2"> | ||
<IconVolume /> | ||
<input | ||
type="range" | ||
min="0" | ||
max="1" | ||
step="0.1" | ||
value={soundVolume} | ||
id="notification-sound-volume" | ||
name="soundVolume" | ||
class="w-[360px]" | ||
></input> | ||
</div> | ||
</div> | ||
|
||
<div class="flex"> | ||
<button type="submit" class="button button--accent mt-6"> | ||
Save | ||
</button> | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
</Page> | ||
</Layout> | ||
) | ||
} |