-
Notifications
You must be signed in to change notification settings - Fork 5
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
AK-14 - Added page titles #306
base: main
Are you sure you want to change the base?
Changes from 1 commit
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,47 @@ | ||
import { useEffect } from 'react' | ||
import { useParams } from 'react-router-dom' | ||
|
||
const setTitle = (title: string) => { | ||
document.title = title | ||
} | ||
|
||
export const useTitle = (customString?: string) => { | ||
const urlParams = useParams() | ||
useEffect(() => { | ||
const currentTitle = document.title | ||
let pageTitle = `Lora` | ||
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 think it would be good for all pages to start with Probably the easiest way to do this is accumulate in an array, then
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 have a small preference for omitting the So: What do you think? 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. And if we omit the
May not make much difference though, so this is quite subjective 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'm happy with both of those suggestions. 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. Me too. I'll make these updates today. |
||
if (customString) { | ||
pageTitle += ` ${customString}` | ||
} | ||
if (urlParams.transactionId) { | ||
Check failure on line 16 in src/utils/use-title.ts GitHub Actions / Run PR checks / node-cisrc/features/fund/fund-page.test.tsx > fund-page > when on localnet > should render the localnet funding controls
|
||
pageTitle += ` - TxnId:${urlParams.transactionId}` | ||
} | ||
if (urlParams.transactionId && urlParams['*']) { | ||
pageTitle += `, Inner:${urlParams['*']}` | ||
} | ||
if (urlParams.round) { | ||
pageTitle += ` - Block:${urlParams.round}` | ||
} | ||
if (urlParams?.groupId) { | ||
pageTitle += ` - Group:${urlParams.groupId}` | ||
} | ||
if (urlParams?.address) { | ||
pageTitle += ` - Addr:${urlParams.address}` | ||
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. The verbiage we use in these pages is 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. 👍 Will change to use Acct |
||
} | ||
if (urlParams?.applicationId) { | ||
pageTitle += ` - AppId:${urlParams.applicationId}` | ||
} | ||
if (urlParams?.assetId) { | ||
pageTitle += ` - AssetId:${urlParams.assetId}` | ||
} | ||
if (urlParams?.networkId) { | ||
pageTitle += ` - ${urlParams.networkId}` | ||
} | ||
|
||
setTitle(pageTitle) | ||
|
||
return () => { | ||
setTitle(currentTitle) | ||
} | ||
}, [customString, urlParams]) | ||
} |
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.
My thought process here is that anything after the
Lora -
is the page specific portion of the title, so it's a page prefix, even though it's not the title prefix.