Merge pull request #265 from jedmund/bugfixes-20230316

Fix some low-hanging fruit bugs
This commit is contained in:
Justin Edmund 2023-03-16 08:45:21 -07:00 committed by GitHub
commit 51db55c100
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 6 deletions

View file

@ -12,6 +12,7 @@ import { accountState, initialAccountState } from '~utils/accountState'
import { appState, initialAppState } from '~utils/appState'
import { getLocalId } from '~utils/localId'
import { retrieveLocaleCookies } from '~utils/retrieveCookies'
import { setEditKey, storeEditKey } from '~utils/userToken'
import {
DropdownMenu,
@ -196,6 +197,13 @@ const Header = () => {
.remix({ shortcode: partySnapshot.shortcode, body: body })
.then((response) => {
const remix = response.data.party
// Store the edit key in local storage
if (remix.edit_key) {
storeEditKey(remix.id, remix.edit_key)
setEditKey(remix.id, remix.user)
}
router.push(`/p/${remix.shortcode}`)
setRemixToastOpen(true)
})

View file

@ -1,3 +1,7 @@
div[data-radix-popper-content-wrapper] {
z-index: 10 !important;
}
.HovercardContent {
animation: scaleIn $duration-zoom ease-out;
transform-origin: var(--radix-hover-card-content-transform-origin);

View file

@ -3,7 +3,6 @@ import { getCookie } from 'cookies-next'
import { useRouter } from 'next/router'
import { subscribe, useSnapshot } from 'valtio'
import clonedeep from 'lodash.clonedeep'
import ls from 'local-storage'
import PartySegmentedControl from '~components/PartySegmentedControl'
import PartyDetails from '~components/PartyDetails'
@ -17,7 +16,7 @@ import { appState, initialAppState } from '~utils/appState'
import { getLocalId } from '~utils/localId'
import { GridType } from '~utils/enums'
import { retrieveCookies } from '~utils/retrieveCookies'
import { setEditKey, unsetEditKey } from '~utils/userToken'
import { setEditKey, storeEditKey, unsetEditKey } from '~utils/userToken'
import type { DetailsObject } from '~types'
@ -240,10 +239,6 @@ const Party = (props: Props) => {
return team
}
const storeEditKey = (id: string, key: string) => {
ls(id, key)
}
const storeCharacters = (list: Array<GridCharacter>) => {
list.forEach((object: GridCharacter) => {
if (object.position != null)

View file

@ -26,6 +26,10 @@ export const setHeaders = (
}
}
export const storeEditKey = (id: string, key: string) => {
ls(id, key)
}
export const setEditKey = (id: string, user?: User) => {
if (!user) {
const edit_key = get<string>(id)