-
Notifications
You must be signed in to change notification settings - Fork 191
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
fix: Customize 24h vs 12h time formatting globally #63
Changes from all commits
fdd4f62
4b001cf
984cb05
01aefc0
d8022cf
3f48b10
51263f9
653a297
2015953
9d868d6
d885091
345bef5
a3a9601
bd9a8a8
8902220
4fb95ea
8acc527
84c21d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@hyperdx/api': minor | ||
'@hyperdx/app': minor | ||
--- | ||
|
||
feat: time format ui addition |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -37,7 +37,7 @@ export default function SearchTimeRangePicker({ | |||
setInputValue, | ||||
onSearch, | ||||
showLive = false, | ||||
timeFormat = '24h', | ||||
timeFormat = '12h', | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. minor thing - it looks like we end up overwriting this in the UI via hyperdx/packages/app/src/timeQuery.ts Line 18 in f231d1f
That being said, I don't think it's a huge deal, and something we can probably clean up once #75 lands since it might conflict anyways. |
||||
}: { | ||||
inputValue: string; | ||||
setInputValue: (str: string) => any; | ||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ import Link from 'next/link'; | |
import { | ||
Badge, | ||
Button, | ||
ToggleButton, | ||
ToggleButtonGroup, | ||
Container, | ||
Form, | ||
Modal, | ||
|
@@ -13,6 +15,8 @@ import { CopyToClipboard } from 'react-copy-to-clipboard'; | |
import { toast } from 'react-toastify'; | ||
import { useState } from 'react'; | ||
|
||
import useUserPreferences from './useUserPreferences'; | ||
import { TimeFormat } from './useUserPreferences'; | ||
import AppNav from './AppNav'; | ||
import api from './api'; | ||
import { isValidUrl } from './utils'; | ||
|
@@ -34,6 +38,9 @@ export default function TeamPage() { | |
const rotateTeamApiKey = api.useRotateTeamApiKey(); | ||
const saveWebhook = api.useSaveWebhook(); | ||
const deleteWebhook = api.useDeleteWebhook(); | ||
const setTimeFormat = useUserPreferences().setTimeFormat; | ||
const timeFormat = useUserPreferences().timeFormat; | ||
const handleTimeButtonClick = (val: TimeFormat) => setTimeFormat(val); | ||
|
||
const hasAllowedAuthMethods = | ||
team?.allowedAuthMethods != null && team?.allowedAuthMethods.length > 0; | ||
|
@@ -442,6 +449,42 @@ export default function TeamPage() { | |
</Modal.Body> | ||
</Modal> | ||
</div> | ||
<div className="text-muted my-2"> | ||
Note: Only affects your own view and does not propagate to other | ||
team members. | ||
</div> | ||
<div> | ||
<h2 className="mt-5">Time Format</h2> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know we don't have a global personal setting place, could we maybe for now just put some subtext describing that this setting is a local setting and won't propagate across the entire team? Since this settings page is technically supposed to be the team page. Something like:
Don't want to block this PR on how we should be treating personal vs team settings :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea, I'll implement this |
||
<ToggleButtonGroup | ||
type="radio" | ||
value={timeFormat} | ||
onChange={handleTimeButtonClick} | ||
name="buttons" | ||
> | ||
<ToggleButton | ||
id="tbg-btn-1" | ||
value="24h" | ||
variant={ | ||
timeFormat === '24h' | ||
? 'outline-success' | ||
: 'outline-secondary' | ||
} | ||
> | ||
24h | ||
</ToggleButton> | ||
<ToggleButton | ||
id="tbg-btn-2" | ||
value="12h" | ||
variant={ | ||
timeFormat === '12h' | ||
? 'outline-success' | ||
: 'outline-secondary' | ||
} | ||
> | ||
12h | ||
</ToggleButton> | ||
</ToggleButtonGroup> | ||
</div> | ||
</> | ||
)} | ||
</Container> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: extra new line