-
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.
🔀 Merge pull request #15 from NMSCD/develop
🔖 0.8.5
- Loading branch information
Showing
10 changed files
with
148 additions
and
19 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Binary file not shown.
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,34 @@ | ||
import { FormControl, FormLabel } from '@chakra-ui/react'; | ||
import React from 'react'; | ||
import { ISettingOptionCompProps } from '../../components/setting/settingCommon'; | ||
|
||
interface IProps extends ISettingOptionCompProps<boolean> { | ||
icon?: string; | ||
width?: string; | ||
customOnClick?: (jsonStr: string) => void; | ||
} | ||
|
||
export const SettingLink: React.FC<IProps> = (props: IProps) => { | ||
return ( | ||
<FormControl | ||
key={props.id} | ||
display="flex" | ||
alignItems="center" | ||
className="noselect" | ||
width={props.width ?? '270px'} | ||
onClick={() => { | ||
if (props.customOnClick == null) return; | ||
const json = props.getCurrentJson(); | ||
props.customOnClick(json); | ||
}} | ||
> | ||
{ | ||
props.icon != null && ( | ||
<img src={props.icon} alt={props.label} style={{ maxHeight: '1.5em', paddingRight: '0.5em' }} /> | ||
) | ||
} | ||
<FormLabel htmlFor={props.id} mb="0">{props.label}</FormLabel> | ||
</FormControl> | ||
); | ||
} | ||
|
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 |
---|---|---|
@@ -1,8 +1,9 @@ | ||
export const AppImages = { | ||
assistantNMS: 'https://avatars.githubusercontent.com/u/54021133?s=200', | ||
kurt: 'https://kurtlourens.com/assets/images/KurtAvatar.svg', | ||
meogi: './assets/img/meogi.webp', | ||
nmsHub: './assets/img/invisible.webp', | ||
silent: './assets/img/silent.jpg', | ||
monkeyMan: 'https://avatars.githubusercontent.com/u/8000597?v=4', | ||
} | ||
assistantNMS: "https://avatars.githubusercontent.com/u/54021133?s=200", | ||
kurt: "https://kurtlourens.com/assets/images/KurtAvatar.svg", | ||
meogi: "./assets/img/meogi.webp", | ||
nmsHub: "./assets/img/invisible.webp", | ||
silent: "./assets/img/silent.jpg", | ||
monkeyMan: "https://avatars.githubusercontent.com/u/8000597?v=4", | ||
nmsCenter: "./assets/img/nms.center.webp", | ||
}; |
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,64 @@ | ||
import { ToastService } from "../services/common/toastService"; | ||
|
||
export const navigateToNmsCenterEggDelivery = | ||
(toastService: ToastService) => (json: string) => { | ||
const jsonObj = JSON.parse(json); | ||
const encoded = minifyPetJson(jsonObj); | ||
|
||
const url = `https://nomansapp.com/?service=egg&base64=${encoded}`; | ||
|
||
try { | ||
window.open(url, "_blank")!.focus(); | ||
return; | ||
} catch {} | ||
|
||
navigator?.clipboard?.writeText?.(url)?.then?.(() => { | ||
toastService.warn( | ||
"Something went wrong but the url was copied to your clipboard. Please open a new tab and paste the url", | ||
{ | ||
autoClose: false, | ||
} | ||
); | ||
}); | ||
}; | ||
|
||
export const minifyPetJson = (jsonObj: any): string => { | ||
let encoded = btoa(JSON.stringify(jsonObj)); | ||
const maxLength = 1800; | ||
|
||
if (encoded.length > maxLength) { | ||
jsonObj.CustomName = ""; | ||
jsonObj.CustomSpeciesName = ""; | ||
|
||
encoded = btoa(JSON.stringify(jsonObj)); | ||
} | ||
|
||
if (encoded.length > maxLength) { | ||
jsonObj.Scale = Number(jsonObj.Scale.toFixed(2)); | ||
jsonObj.Traits[0] = Number(jsonObj.Traits[0].toFixed(2)); | ||
jsonObj.Traits[1] = Number(jsonObj.Traits[1].toFixed(2)); | ||
jsonObj.Traits[2] = Number(jsonObj.Traits[2].toFixed(2)); | ||
jsonObj.Moods[0] = Number(jsonObj.Moods[0].toFixed(2)); | ||
jsonObj.Moods[1] = Number(jsonObj.Moods[1].toFixed(2)); | ||
|
||
encoded = btoa(JSON.stringify(jsonObj)); | ||
} | ||
|
||
if (encoded.length > maxLength) { | ||
if (jsonObj.CreatureSeed[1].startsWith("0x00")) | ||
jsonObj.CreatureSeed[1] = "0x00"; | ||
if (jsonObj.CreatureSecondarySeed[1].startsWith("0x00")) | ||
jsonObj.CreatureSecondarySeed[1] = "0x00"; | ||
if (jsonObj.SpeciesSeed[1].startsWith("0x00")) | ||
jsonObj.SpeciesSeed[1] = "0x00"; | ||
if (jsonObj.GenusSeed[1].startsWith("0x00")) jsonObj.GenusSeed[1] = "0x00"; | ||
if (jsonObj.ColourBaseSeed[1].startsWith("0x00")) | ||
jsonObj.ColourBaseSeed[1] = "0x00"; | ||
if (jsonObj.BoneScaleSeed[1].startsWith("0x00")) | ||
jsonObj.BoneScaleSeed[1] = "0x00"; | ||
|
||
encoded = btoa(JSON.stringify(jsonObj)); | ||
} | ||
|
||
return encoded; | ||
}; |
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