Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/Coflnet/hypixel-react in…
Browse files Browse the repository at this point in the history
…to develop
  • Loading branch information
matthias-luger committed May 6, 2024
2 parents 720f89a + 69bd56f commit 205f53e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 7 deletions.
1 change: 0 additions & 1 deletion api/WebsocketHelper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ function initWebsocket(): void {
}

let getNewWebsocket = (isReconnecting: boolean): WebSocket => {
console.log('getNewWebsocket is called')
websocket = new WebSocket(getProperty('websocketEndpoint'))
websocket.onclose = onWebsocketClose
websocket.onerror = onWebsocketError
Expand Down
2 changes: 1 addition & 1 deletion components/Flipper/FlipCustomize/FlipCustomize.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@
#flip-finder-tooltip .tooltip-inner {
max-width: max-content !important;
text-align: left;
}
}
21 changes: 17 additions & 4 deletions components/Flipper/FlipCustomize/FlipCustomize.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ const customSelectStyle = {

function FlipCustomize() {
let [flipCustomizeSettings, setFlipCustomizeSettings] = useState<FlipCustomizeSettings>({})
let [isExportDisabled, setIsExportDisabled] = useState(false)
let { trackEvent } = useMatomo()

useEffect(() => {
setFlipCustomizeSettings(getFlipCustomizeSettings())
let settings = getFlipCustomizeSettings()
setIsExportDisabled(settings.blockExport === true)
setFlipCustomizeSettings({ ...settings })
}, [])

function setFlipCustomizeSetting(key: string, value: any) {
Expand Down Expand Up @@ -552,9 +555,19 @@ function FlipCustomize() {
>
Import
</Button>
<Button onClick={exportFilter} style={{ width: '40%' }}>
Export
</Button>
<Tooltip
type="hover"
content={
<div style={{ width: '40%', marginRight: 0 }}>
<Button onClick={exportFilter} disabled={isExportDisabled} style={{ width: '100%' }}>
Export
</Button>
</div>
}
tooltipContent={
isExportDisabled ? <p>Your settings can't be exported, likely because they are based on a config you bought</p> : undefined
}
/>
{/* This is the "true" upload field. It is called by the "Import"-Button */}
<input onChange={readImportFile} style={{ display: 'none' }} type="file" id="fileUpload" />
</div>
Expand Down
1 change: 1 addition & 0 deletions global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ interface FlipCustomizeSettings {
hideLore?: boolean
modFormat?: string
modCountdown?: boolean
blockExport?: boolean
}

interface FlipRestriction {
Expand Down
4 changes: 3 additions & 1 deletion utils/SettingsUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ export function setSettingsFromServerSide(
hideCopySuccessMessage: !settings.visibility.copySuccessMessage,
finders: FLIP_FINDERS.filter(finder => {
return hasFlag(parseInt(settings.finders), parseInt(finder.value))
}).map(finder => parseInt(finder.value))
}).map(finder => parseInt(finder.value)),
blockExport: settings.blockExport
} as FlipCustomizeSettings

let filter = {
Expand Down Expand Up @@ -441,6 +442,7 @@ export function mapSettingsToApiFormat(filter: FlipperFilter, flipSettings: Flip
copySuccessMessage: !flipSettings.hideCopySuccessMessage,
links: !flipSettings.disableLinks
},
blockExport: flipSettings.blockExport,
finders: flipSettings.finders?.reduce((a, b) => +a + +b, 0),
changer: window.sessionStorage.getItem('sessionId')
}
Expand Down

0 comments on commit 205f53e

Please sign in to comment.