Compare commits

...

22 commits

Author SHA1 Message Date
ba93a146ad Fix Lyria in CharacterRep 2023-07-10 02:12:26 -07:00
686d0d0642 Disable tab pages 2023-07-06 22:26:43 -07:00
af9064a356 Some fixes for scrollable dialogs on mobile
This is 100% not going to scale to devices that are not my iPhone 14 Pro Max, but I can't get env variables working in CSS and something is better than nothing for right now.
2023-07-06 19:22:11 -07:00
2049ad4cf7 Put viewport meta tag in _app 2023-07-06 19:21:35 -07:00
14994bfbbd Fix TableField components on mobile 2023-07-06 18:37:44 -07:00
8dbc6c1c6c Small fix for some modals on mobile
This fixes the slide up animation and the end point so that modals are actually visible on mobile. Ones that scroll still don't work great.
2023-07-06 18:37:30 -07:00
11577a6b61 Ensure name modification works right
Needed a null check? for some reason?
2023-07-06 17:08:37 -07:00
abd98d27c9 Add placeholder to party description 2023-07-06 17:07:05 -07:00
17113e2ad9 Add placeholder extension 2023-07-06 16:58:37 -07:00
5e0bda987d Show localized placeholder for team name 2023-07-06 16:58:29 -07:00
da1acb1463 Allow translation of Heading icons 2023-07-06 16:58:22 -07:00
93e4fd74fd Add toolbar localizations 2023-07-06 16:58:07 -07:00
bed7d0d408
Update transcendence components to work with CSS modules (#350)
* Update transcendence components to use CSS modules

* Fix summon transcendence

Summon transcendence was doing something wonky. This adapts the updateUncap endpoint method to make it a little bit clearer whats going on.
2023-07-06 15:56:23 -07:00
a70c09b373 Fix styles 2023-07-06 03:33:07 -07:00
5b42ca862e Remove duplicate binding 2023-07-06 03:08:12 -07:00
78ae6f2fd1
Merge branch 'main' into staging 2023-07-06 03:06:39 -07:00
8ea2f97aac Fix icon path 2023-07-06 03:05:31 -07:00
8f7670c07b
Merge branch 'main' into staging 2023-07-06 02:55:46 -07:00
83bebdb0c2
Tiptap updates (#343)
* Reinstantiate editor on changes

We can't dynamically update the content, so we have to recreate the Editor whenever something changes (page loads and updates)

* Fix import

@tiptap/core is different than @tiptap/react, who knew

* Added several Tiptap components

* Added a Remix icon that isn't in remixicon-react

* Add colors for highlights

* Add ToolbarButton component

This is to standardize adding Toolbar icons so it wasn't a miserable mess in the Editor file

* Add extensions and implement ToolbarButton

* Remove unused code

* Use party prop and add keys

We always want to use the party in props until the transformer work is done and our source of truth is more reliable.

Also, we are using keys to ensure that the component reloads on new page.

* Component cleanup

* Always use props.party

* Ensure content gets reset when edits are committed

Here, we do some tactical bandaid fixes to ensure that when the user saves data to the server, the editor will show the freshest data in both editable and read-only mode.

In the Editor, its as easy as calling the setContent command in a useEffect hook when the content changes.

In the party, we are saving party in a state and passing it down to the components via props. This is because the party prop we get from pages is only from the first time the server loaded data, so any edits are not reflected. The app state should have the latest updates, but due to reasons I don't completely understand, it is showing the old state first and then the one we want, causing the Editor to get stuck on old data.

By storing the party in a state, we can populate the state from the server when the component mounts, then update it whenever the user saves data since all party data is saved in that component.

* Fix build errors
2023-07-06 02:51:01 -07:00
9adcd50519 Fix background-color on CharacterRep 2023-07-05 22:35:54 -07:00
955cd14762 Override peer dependencies for tiptap mentions
They haven't fixed the suggestion plugin, so we have to use a beta version
2023-07-05 21:43:03 -07:00
15a32d56bb
Rich text editor and support for tagging objects (#340)
* Preliminary work around making an Element type

* Disabled Youtube code for now

* Clean description with DOMPurify

* Update GranblueElement with slug

* Add new api endpoint for searching all resources

* Add new variables and themes

* Remove fixed height on html tag for now

* Update README.md

We renamed the folders for character images from `chara-` to `character-`

* Add no results string

* Add tiptap and associated packages

* Update .gitignore

* Update components that use character images

* Add Editor component

This commit adds the bulk of the code for our new rich-text editor. The Editor component will be used to edit and display rich text via Tiptap.

* Add mention components

This adds the code required for us to mention objects in rich text fields like team descriptions.

The mentionSuggestion util fetches data from the server and serves it to MentionList for the user to select, then inserts it into the Editor as a token.

* Implements Editor in edit team and team footer

This implements the Editor component in EditPartyModal and PartyFooter. In PartyFooter, it is read-only.

* Remove min-width on tokens

* Add rudimentary conversion for old descriptions

Old descriptions just translate as a blob of text, so we try to insert some paragraphs and newlines to keep things presentable and lessen the load if users decide to update

* Add support for displaying jobs in MentionList

* Handle numbers and value=0 better

* Keep description reactive

This shouldn't work? The snapshot should be the reactive one? I don't fucking know

* Send locale to api with search query

* Delete getLocale.tsx

We didn't actually use this

* Fix build errors
2023-07-05 21:19:34 -07:00
38 changed files with 333 additions and 206 deletions

View file

@ -26,7 +26,7 @@ const AboutHead = ({ page }: Props) => {
name="description" name="description"
content={t(`page.descriptions.${currentPage}`)} content={t(`page.descriptions.${currentPage}`)}
/> />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/x-icon" href="/images/favicon.png" /> <link rel="icon" type="image/x-icon" href="/images/favicon.png" />
{/* OpenGraph */} {/* OpenGraph */}

View file

@ -192,11 +192,11 @@ const CharacterUnit = ({
else if (gridCharacter.uncap_level > 2) suffix = '02' else if (gridCharacter.uncap_level > 2) suffix = '02'
// Special casing for Lyria (and Young Cat eventually) // Special casing for Lyria (and Young Cat eventually)
if (gridCharacter.object.granblue_id === '3030182000') { if (character.element === 0) {
let element = 1 let element = 1
if (grid.weapons.mainWeapon && grid.weapons.mainWeapon.element) { if (grid.weapons.mainWeapon && grid.weapons.mainWeapon.element) {
element = grid.weapons.mainWeapon.element element = grid.weapons.mainWeapon.element
} else if (party.element != 0) { } else if (party.element !== 0) {
element = party.element element = party.element
} }

View file

@ -13,6 +13,14 @@
color: inherit; color: inherit;
z-index: 10; z-index: 10;
@include breakpoint(phone) {
place-items: flex-end;
overflow-y: hidden;
&.filter {
}
}
.dialogContent { .dialogContent {
$multiplier: 4; $multiplier: 4;
@ -51,11 +59,11 @@
border-bottom-left-radius: 0; border-bottom-left-radius: 0;
border-bottom-right-radius: 0; border-bottom-right-radius: 0;
min-width: inherit; min-width: inherit;
min-height: 90vh; min-height: inherit;
transform: initial; transform: initial;
left: 0; left: 0;
right: 0; right: 0;
top: 5vh; top: $unit-10x;
height: auto; height: auto;
width: 100%; width: 100%;
} }
@ -101,110 +109,6 @@
overflow-y: auto; overflow-y: auto;
} }
} }
&.Conflict {
$weapon-diameter: 14rem;
.Content {
display: flex;
flex-direction: column;
gap: $unit-4x;
padding: $unit-4x $unit-4x $unit-2x $unit-4x;
& > p {
font-size: $font-regular;
line-height: 1.4;
strong {
font-weight: $bold;
}
&:lang(ja) {
line-height: 1.4;
}
}
}
.weapon,
.character {
display: flex;
flex-direction: column;
gap: $unit;
text-align: center;
width: $weapon-diameter;
font-weight: $medium;
img {
border-radius: 1rem;
width: $weapon-diameter;
height: auto;
}
span {
line-height: 1.3;
}
}
.Diagram {
display: grid;
grid-template-columns: 1fr auto 1fr;
align-items: flex-start;
&.CharacterDiagram {
align-items: center;
}
ul {
align-items: center;
display: flex;
flex-direction: column;
gap: $unit-2x;
}
.wrapper {
display: flex;
justify-content: center;
width: 100%;
}
.arrow {
align-items: center;
color: $grey-55;
display: flex;
font-size: 4rem;
text-align: center;
height: $weapon-diameter;
justify-content: center;
}
}
footer {
display: flex;
flex-direction: row;
gap: $unit;
.Button {
font-size: $font-regular;
padding: ($unit * 1.5) ($unit * 2);
width: 100%;
&.btn-disabled {
background: $grey-90;
color: $grey-70;
cursor: not-allowed;
}
&:not(.btn-disabled) {
background: $grey-90;
color: $grey-50;
&:hover {
background: $grey-80;
}
}
}
}
}
} }
@keyframes openModalDesktop { @keyframes openModalDesktop {
@ -221,11 +125,20 @@
@keyframes slideUp { @keyframes slideUp {
0% { 0% {
transform: translate(0%, 100%); transform: translateY(400px);
animation-timing-function: ease-out;
}
60% {
transform: translateY(-30px);
animation-timing-function: ease-in;
}
80% {
transform: translateY(10px);
animation-timing-function: ease-out;
} }
100% { 100% {
transform: translate(0, 0%); transform: translateY(0px);
animation-timing-function: ease-in;
} }
} }
} }

View file

@ -11,6 +11,7 @@ interface Props
React.DialogHTMLAttributes<HTMLDivElement>, React.DialogHTMLAttributes<HTMLDivElement>,
HTMLDivElement HTMLDivElement
> { > {
wrapperClassName?: string
headerref?: React.RefObject<HTMLDivElement> headerref?: React.RefObject<HTMLDivElement>
footerref?: React.RefObject<HTMLDivElement> footerref?: React.RefObject<HTMLDivElement>
scrollable?: boolean scrollable?: boolean
@ -127,7 +128,16 @@ const DialogContent = React.forwardRef<HTMLDivElement, Props>(function Dialog(
return ( return (
<DialogPrimitive.Portal> <DialogPrimitive.Portal>
<dialog className={styles.dialog}> <dialog
className={classNames(
{
[styles.dialog]: true,
},
props.wrapperClassName
?.split(' ')
.map((className) => styles[className])
)}
>
<DialogPrimitive.Content <DialogPrimitive.Content
{...props} {...props}
className={classes} className={classes}

View file

@ -16,4 +16,11 @@
display: flex; display: flex;
gap: $unit; gap: $unit;
} }
@include breakpoint(phone) {
position: fixed;
bottom: $unit-14x;
left: 0;
right: 0;
}
} }

View file

@ -36,6 +36,14 @@
outline: none; outline: none;
} }
p.empty:first-child::before {
color: var(--text-tertiary);
content: attr(data-placeholder);
float: left;
height: 0;
pointer-events: none;
}
&.bound { &.bound {
background-color: var(--input-bound-bg); background-color: var(--input-bound-bg);
@ -74,21 +82,21 @@
h1 { h1 {
font-size: $font-xlarge; font-size: $font-xlarge;
font-weight: $medium; font-weight: $medium;
margin: $unit 0; margin: $unit-2x 0;
text-align: left; text-align: left;
} }
h2 { h2 {
font-size: $font-large; font-size: $font-large;
font-weight: $medium; font-weight: $medium;
margin: $unit 0; margin: $unit-2x 0;
text-align: left; text-align: left;
} }
h3 { h3 {
font-size: $font-regular; font-size: $font-regular;
font-weight: $medium; font-weight: $medium;
margin: $unit 0; margin: $unit-2x 0;
text-align: left; text-align: left;
} }
@ -96,6 +104,7 @@
border-radius: $item-corner-small; border-radius: $item-corner-small;
background: var(--highlight-bg); background: var(--highlight-bg);
color: var(--highlight-text); color: var(--highlight-text);
font-weight: $normal;
padding: 1px $unit-fourth; padding: 1px $unit-fourth;
} }
@ -116,15 +125,18 @@
.mention { .mention {
border-radius: $item-corner-small; border-radius: $item-corner-small;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
0 1px 0px rgba(0, 0, 0, 0.25); 0 1px 0px var(--null-shadow);
background: var(--card-bg); background: var(--null-bg);
color: var(--text-primary); color: var(--text-primary);
font-weight: $medium; font-weight: $medium;
font-size: 15px; font-size: 15px;
padding: 1px $unit-half; padding: 1px $unit-half;
transition: all 0.1s ease-out;
&:hover { &:hover {
background: var(--card-bg-hover); background: var(--null-bg-hover);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
0 1px 0px var(--null-shadow-hover);
text-decoration: none; text-decoration: none;
cursor: pointer; cursor: pointer;
} }
@ -136,6 +148,7 @@
color: var(--fire-text); color: var(--fire-text);
&:hover { &:hover {
background: var(--fire-bg-hover);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
0 1px 0px var(--fire-shadow-hover); 0 1px 0px var(--fire-shadow-hover);
color: var(--fire-text-hover); color: var(--fire-text-hover);
@ -149,6 +162,7 @@
color: var(--water-text); color: var(--water-text);
&:hover { &:hover {
background: var(--water-bg-hover);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
0 1px 0px var(--water-shadow-hover); 0 1px 0px var(--water-shadow-hover);
color: var(--water-text-hover); color: var(--water-text-hover);
@ -162,6 +176,7 @@
color: var(--earth-text); color: var(--earth-text);
&:hover { &:hover {
background: var(--earth-bg-hover);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
0 1px 0px var(--earth-shadow-hover); 0 1px 0px var(--earth-shadow-hover);
color: var(--earth-text-hover); color: var(--earth-text-hover);
@ -188,6 +203,7 @@
color: var(--dark-text); color: var(--dark-text);
&:hover { &:hover {
background: var(--dark-bg-hover);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
0 1px 0px var(--dark-shadow-hover); 0 1px 0px var(--dark-shadow-hover);
color: var(--dark-text-hover); color: var(--dark-text-hover);
@ -201,6 +217,7 @@
color: var(--light-text); color: var(--light-text);
&:hover { &:hover {
background: var(--light-bg-hover);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
0 1px 0px var(--light-shadow-hover); 0 1px 0px var(--light-shadow-hover);
color: var(--light-text-hover); color: var(--light-text-hover);

View file

@ -1,9 +1,12 @@
import { ComponentProps, useCallback, useEffect } from 'react' import { ComponentProps, useCallback, useEffect } from 'react'
import { useRouter } from 'next/router'
import { useEditor, EditorContent } from '@tiptap/react' import { useEditor, EditorContent } from '@tiptap/react'
import { useRouter } from 'next/router'
import { useTranslation } from 'next-i18next'
import StarterKit from '@tiptap/starter-kit' import StarterKit from '@tiptap/starter-kit'
import Link from '@tiptap/extension-link' import Link from '@tiptap/extension-link'
import Highlight from '@tiptap/extension-highlight' import Highlight from '@tiptap/extension-highlight'
import Placeholder from '@tiptap/extension-placeholder'
import Typography from '@tiptap/extension-typography' import Typography from '@tiptap/extension-typography'
import Youtube from '@tiptap/extension-youtube' import Youtube from '@tiptap/extension-youtube'
import CustomMention from '~extensions/CustomMention' import CustomMention from '~extensions/CustomMention'
@ -18,7 +21,7 @@ import ItalicIcon from 'remixicon-react/ItalicIcon'
import StrikethroughIcon from 'remixicon-react/StrikethroughIcon' import StrikethroughIcon from 'remixicon-react/StrikethroughIcon'
import UnorderedListIcon from 'remixicon-react/ListUnorderedIcon' import UnorderedListIcon from 'remixicon-react/ListUnorderedIcon'
import OrderedListIcon from '~public/icons/remix/list-ordered-2.svg' import OrderedListIcon from '~public/icons/remix/list-ordered-2.svg'
import PaintbrushIcon from 'remixicon-react/PaintbrushLineIcon' import PaintbrushIcon from 'remixicon-react/PaintBrushLineIcon'
import H1Icon from 'remixicon-react/H1Icon' import H1Icon from 'remixicon-react/H1Icon'
import H2Icon from 'remixicon-react/H2Icon' import H2Icon from 'remixicon-react/H2Icon'
import H3Icon from 'remixicon-react/H3Icon' import H3Icon from 'remixicon-react/H3Icon'
@ -45,6 +48,8 @@ const Editor = ({
const router = useRouter() const router = useRouter()
const locale = router.locale || 'en' const locale = router.locale || 'en'
const { t } = useTranslation('common')
useEffect(() => { useEffect(() => {
editor?.commands.setContent(formatContent(content)) editor?.commands.setContent(formatContent(content))
}, [content]) }, [content])
@ -72,6 +77,10 @@ const Editor = ({
}), }),
Link, Link,
Highlight, Highlight,
Placeholder.configure({
emptyEditorClass: styles.empty,
placeholder: t('modals.edit_team.placeholders.description'),
}),
Typography, Typography,
CustomMention.configure({ CustomMention.configure({
renderLabel({ options, node }) { renderLabel({ options, node }) {

View file

@ -21,12 +21,6 @@
&.flush { &.flush {
padding: 0; padding: 0;
} }
.Arrow {
fill: var(--dialog-bg);
filter: drop-shadow(0px 1px 1px rgb(0 0 0 / 0.18));
margin-top: -1px;
}
} }
.trigger { .trigger {

View file

@ -0,0 +1,5 @@
.arrow {
fill: var(--dialog-bg);
filter: drop-shadow(0px 1px 1px rgb(0 0 0 / 0.18));
margin-top: -1px;
}

View file

@ -63,6 +63,10 @@
&.table { &.table {
min-width: $unit * 30; min-width: $unit * 30;
@include breakpoint(phone) {
width: 100%;
}
} }
&.hidden { &.hidden {

View file

@ -14,6 +14,10 @@
border-radius: 9999px; border-radius: 9999px;
height: 3px; height: 3px;
} }
&.table {
flex-grow: 1;
}
} }
.range { .range {

View file

@ -54,6 +54,7 @@ const SliderTableField = (props: Props) => {
max={props.max} max={props.max}
step={props.step} step={props.step}
value={[props.value ? props.value : 0]} value={[props.value ? props.value : 0]}
className="table"
onValueChange={handleValueChange} onValueChange={handleValueChange}
onValueCommit={handleValueCommit} onValueCommit={handleValueCommit}
/> />

View file

@ -36,6 +36,14 @@
} }
} }
&.switch {
@include breakpoint(phone) {
align-items: center;
flex-direction: row;
justify-content: space-between;
}
}
.left { .left {
align-items: center; align-items: center;
display: flex; display: flex;

View file

@ -24,7 +24,13 @@ const ToolbarIcon = ({ editor, action, level, icon, onClick }: Props) => {
}) })
return ( return (
<Tooltip content={t(`toolbar.tooltips.${action}`)}> <Tooltip
content={
level
? t(`toolbar.tooltips.${action}`, { level: level })
: t(`toolbar.tooltips.${action}`)
}
>
<button onClick={onClick} className={classes}> <button onClick={onClick} className={classes}>
{icon} {icon}
</button> </button>

View file

@ -39,5 +39,6 @@
@include breakpoint(phone) { @include breakpoint(phone) {
gap: $unit-4x; gap: $unit-4x;
margin-bottom: $unit * 24;
} }
} }

View file

@ -402,7 +402,8 @@ const FilterModal = (props: Props) => {
<Dialog open={open} onOpenChange={openChange}> <Dialog open={open} onOpenChange={openChange}>
<DialogTrigger asChild>{props.children}</DialogTrigger> <DialogTrigger asChild>{props.children}</DialogTrigger>
<DialogContent <DialogContent
className="Filter" className="filter"
wrapperClassName="filter"
headerref={headerRef} headerref={headerRef}
footerref={footerRef} footerref={footerRef}
onEscapeKeyDown={onEscapeKeyDown} onEscapeKeyDown={onEscapeKeyDown}

View file

@ -11,7 +11,7 @@ const NewHead = () => {
{/* HTML */} {/* HTML */}
<title>{t('page.titles.new')}</title> <title>{t('page.titles.new')}</title>
<meta name="description" content={t('page.descriptions.new')} /> <meta name="description" content={t('page.descriptions.new')} />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/x-icon" href="/images/favicon.png" /> <link rel="icon" type="image/x-icon" href="/images/favicon.png" />
{/* OpenGraph */} {/* OpenGraph */}

View file

@ -20,7 +20,7 @@ const ProfileHead = ({ user }: Props) => {
username: user.username, username: user.username,
})} })}
/> />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/x-icon" href="/images/favicon.png" /> <link rel="icon" type="image/x-icon" href="/images/favicon.png" />
{/* OpenGraph */} {/* OpenGraph */}

View file

@ -9,7 +9,7 @@ const SavedHead = () => {
return ( return (
<Head> <Head>
<title>{t('page.titles.saved')}</title> <title>{t('page.titles.saved')}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/x-icon" href="/images/favicon.png" /> <link rel="icon" type="image/x-icon" href="/images/favicon.png" />
<meta property="og:title" content={t('page.titles.saved')} /> <meta property="og:title" content={t('page.titles.saved')} />

View file

@ -11,7 +11,6 @@ const TeamsHead = () => {
{/* HTML */} {/* HTML */}
<title>{t('page.titles.discover')}</title> <title>{t('page.titles.discover')}</title>
<meta name="description" content={t('page.descriptions.discover')} /> <meta name="description" content={t('page.descriptions.discover')} />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/x-icon" href="/images/favicon.png" /> <link rel="icon" type="image/x-icon" href="/images/favicon.png" />
{/* OpenGraph */} {/* OpenGraph */}

View file

@ -297,7 +297,8 @@ const EditPartyModal = ({
// Methods: Modification checking // Methods: Modification checking
function hasBeenModified() { function hasBeenModified() {
const nameChanged = const nameChanged =
name !== party.name && !(name === '' && party.name === undefined) name !== party.name &&
!(name === '' && (party.name === undefined || party.name === null))
const descriptionChanged = const descriptionChanged =
description !== party.description && description !== party.description &&
!(description === '' && party.description === undefined) !(description === '' && party.description === undefined)
@ -433,7 +434,7 @@ const EditPartyModal = ({
const nameField = ( const nameField = (
<Input <Input
name="name" name="name"
placeholder="Name your team" placeholder={t('modals.edit_team.placeholders.name')}
autoFocus={true} autoFocus={true}
value={name} value={name}
maxLength={50} maxLength={50}
@ -476,15 +477,6 @@ const EditPartyModal = ({
/> />
) )
const editorField = (
<Editor
bound={true}
content={description}
editable={true}
onUpdate={handleEditorUpdate}
/>
)
const chargeAttackField = ( const chargeAttackField = (
<SwitchTableField <SwitchTableField
name="charge_attack" name="charge_attack"

View file

@ -32,7 +32,7 @@ const PartyHead = ({ party, meta }: Props) => {
raidName: party.raid ? party.raid.name[locale] : '', raidName: party.raid ? party.raid.name[locale] : '',
})} })}
/> />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/x-icon" href="/images/favicon.png" /> <link rel="icon" type="image/x-icon" href="/images/favicon.png" />
{/* OpenGraph */} {/* OpenGraph */}

View file

@ -17,10 +17,7 @@ const CHARACTERS_COUNT = 3
const CharacterRep = (props: Props) => { const CharacterRep = (props: Props) => {
// Localization for alt tags // Localization for alt tags
const router = useRouter() const locale = useRouter().locale || 'en'
const { t } = useTranslation('common')
const locale =
router.locale && ['en', 'ja'].includes(router.locale) ? router.locale : 'en'
// Component state // Component state
const [characters, setCharacters] = useState<GridArray<Character>>({}) const [characters, setCharacters] = useState<GridArray<Character>>({})
@ -95,8 +92,15 @@ const CharacterRep = (props: Props) => {
else if (gridCharacter.uncap_level >= 5) suffix = '03' else if (gridCharacter.uncap_level >= 5) suffix = '03'
else if (gridCharacter.uncap_level > 2) suffix = '02' else if (gridCharacter.uncap_level > 2) suffix = '02'
if (character.element == 0) { let element = props.element
url = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/character-main/${character.granblue_id}_${props.element}.jpg` if (element === 0 && character.element !== 0) {
element = character.element
} else if (element === 0 && character.element === 0) {
element = 1
}
if (character.element === 0) {
url = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/character-main/${character.granblue_id}_${suffix}_0${element}.jpg`
} else { } else {
url = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/character-main/${character.granblue_id}_${suffix}.jpg` url = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/character-main/${character.granblue_id}_${suffix}.jpg`
} }

View file

@ -261,11 +261,9 @@ const SummonGrid = (props: Props) => {
try { try {
if (stage != previousTranscendenceStages[position]) if (stage != previousTranscendenceStages[position])
await api.endpoints.grid_summons await api.updateTranscendence('summon', id, stage).then((response) => {
.update(id, payload) storeGridSummon(response.data.grid_summon)
.then((response) => { })
storeGridSummon(response.data.grid_summon)
})
} catch (error) { } catch (error) {
console.error(error) console.error(error)

View file

@ -1,4 +1,4 @@
.Fragment { .fragment {
$degrees: 72deg; $degrees: 72deg;
$origWidth: 29px; $origWidth: 29px;
@ -28,11 +28,11 @@
cursor: pointer; cursor: pointer;
} }
&.Visible { &.visible {
opacity: 1; opacity: 1;
} }
&.Stage1 { &.stage1 {
top: 3px; top: 3px;
left: 18px; left: 18px;
@ -41,7 +41,7 @@
// } // }
} }
&.Stage2 { &.stage2 {
top: 10px; top: 10px;
left: 27px; left: 27px;
transform: rotate($degrees); transform: rotate($degrees);
@ -51,7 +51,7 @@
// } // }
} }
&.Stage3 { &.stage3 {
top: 21px; top: 21px;
left: 24px; left: 24px;
transform: rotate($degrees * 2); transform: rotate($degrees * 2);
@ -61,7 +61,7 @@
// } // }
} }
&.Stage4 { &.stage4 {
top: 21px; top: 21px;
left: 12px; left: 12px;
transform: rotate($degrees * 3); transform: rotate($degrees * 3);
@ -71,7 +71,7 @@
// } // }
} }
&.Stage5 { &.stage5 {
top: 10px; top: 10px;
left: 8px; left: 8px;
transform: rotate($degrees * 4); transform: rotate($degrees * 4);

View file

@ -1,5 +1,5 @@
import React from 'react' import React from 'react'
import classnames from 'classnames' import classNames from 'classnames'
import styles from './index.module.scss' import styles from './index.module.scss'
@ -18,14 +18,14 @@ const TranscendenceFragment = ({
onClick, onClick,
onHover, onHover,
}: Props) => { }: Props) => {
const classes = classnames({ const classes = classNames({
Fragment: true, [styles.fragment]: true,
Visible: visible, [styles.visible]: visible,
Stage1: stage === 1, [styles.stage1]: stage === 1,
Stage2: stage === 2, [styles.stage2]: stage === 2,
Stage3: stage === 3, [styles.stage3]: stage === 3,
Stage4: stage === 4, [styles.stage4]: stage === 4,
Stage5: stage === 5, [styles.stage5]: stage === 5,
}) })
function handleClick() { function handleClick() {

View file

@ -1,11 +1,20 @@
.Transcendence.Popover { .transcendence {
align-items: center; display: flex;
flex-direction: column; flex-direction: column;
gap: $unit-half; gap: $unit-half;
display: flex; align-items: center;
justify-content: center;
width: $unit-10x; width: $unit-10x;
height: $unit-10x; height: $unit-10x;
justify-content: center;
animation: scaleIn $duration-zoom ease-out;
background: var(--dialog-bg);
border-radius: $card-corner;
border: 0.5px solid rgba(0, 0, 0, 0.18);
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.24);
outline: none;
padding: $unit;
transform-origin: var(--radix-popover-content-transform-origin);
z-index: 32; z-index: 32;
&.open { &.open {
@ -18,7 +27,50 @@
font-weight: $medium; font-weight: $medium;
} }
.Pending { .pending {
color: $yellow; color: $yellow;
} }
} }
@keyframes scaleIn {
0% {
opacity: 0;
transform: scale(0);
}
20% {
opacity: 0.2;
transform: scale(0.4);
}
40% {
opacity: 0.4;
transform: scale(0.8);
}
60% {
opacity: 0.6;
transform: scale(1);
}
65% {
opacity: 0.65;
transform: scale(1.1);
}
70% {
opacity: 0.7;
transform: scale(1);
}
75% {
opacity: 0.75;
transform: scale(0.98);
}
80% {
opacity: 0.8;
transform: scale(1.02);
}
90% {
opacity: 0.9;
transform: scale(0.96);
}
100% {
opacity: 1;
transform: scale(1);
}
}

View file

@ -2,8 +2,8 @@ import React, { PropsWithChildren, useEffect, useState } from 'react'
import { useTranslation } from 'next-i18next' import { useTranslation } from 'next-i18next'
import classNames from 'classnames' import classNames from 'classnames'
import { Popover } from '@radix-ui/react-popover'
import { import {
Popover,
PopoverAnchor, PopoverAnchor,
PopoverContent, PopoverContent,
} from '~components/common/PopoverContent' } from '~components/common/PopoverContent'
@ -40,12 +40,8 @@ const TranscendencePopover = ({
const popoverRef = React.createRef<HTMLDivElement>() const popoverRef = React.createRef<HTMLDivElement>()
const classes = classNames({
Transcendence: true,
})
const levelClasses = classNames({ const levelClasses = classNames({
Pending: stage != currentStage, [styles.pending]: stage != currentStage,
}) })
useEffect(() => { useEffect(() => {
@ -77,16 +73,20 @@ const TranscendencePopover = ({
return ( return (
<Popover open={open} onOpenChange={onOpenChange}> <Popover open={open} onOpenChange={onOpenChange}>
<PopoverAnchor>{children}</PopoverAnchor> <PopoverAnchor>{children}</PopoverAnchor>
<PopoverContent className={classes} ref={popoverRef} tabIndex={tabIndex}> <PopoverContent
className={styles.transcendence}
ref={popoverRef}
tabIndex={tabIndex}
>
<TranscendenceStar <TranscendenceStar
className="Interactive Base" className="interactive base"
editable={true} editable={true}
interactive={true} interactive={true}
stage={stage} stage={stage}
onFragmentClick={handleFragmentClicked} onFragmentClick={handleFragmentClicked}
onFragmentHover={handleFragmentHovered} onFragmentHover={handleFragmentHovered}
/> />
<h4> <h4 className="name">
<span>{t('level')}&nbsp;</span> <span>{t('level')}&nbsp;</span>
<span className={levelClasses}>{baseLevel + 10 * currentStage}</span> <span className={levelClasses}>{baseLevel + 10 * currentStage}</span>
</h4> </h4>

View file

@ -46,9 +46,12 @@ const TranscendenceStar = ({
[styles.stage5]: stage === 5, [styles.stage5]: stage === 5,
}) })
const baseImageClasses = classnames(className, { const baseImageClasses = classnames(
[styles.figure]: true, {
}) [styles.figure]: true,
},
className?.split(' ').map((c) => styles[c])
)
useEffect(() => { useEffect(() => {
setVisibleStage(stage) setVisibleStage(stage)
@ -87,7 +90,7 @@ const TranscendenceStar = ({
onMouseLeave={interactive ? handleMouseLeave : () => {}} onMouseLeave={interactive ? handleMouseLeave : () => {}}
tabIndex={tabIndex} tabIndex={tabIndex}
> >
<div className="Fragments"> <div className={styles.fragments}>
{[...Array(NUM_FRAGMENTS)].map((e, i) => { {[...Array(NUM_FRAGMENTS)].map((e, i) => {
const loopStage = i + 1 const loopStage = i + 1
return interactive ? ( return interactive ? (

14
package-lock.json generated
View file

@ -23,6 +23,7 @@
"@tiptap/extension-highlight": "^2.0.3", "@tiptap/extension-highlight": "^2.0.3",
"@tiptap/extension-link": "^2.0.3", "@tiptap/extension-link": "^2.0.3",
"@tiptap/extension-mention": "^2.0.3", "@tiptap/extension-mention": "^2.0.3",
"@tiptap/extension-placeholder": "^2.0.3",
"@tiptap/extension-typography": "^2.0.3", "@tiptap/extension-typography": "^2.0.3",
"@tiptap/extension-youtube": "^2.0.3", "@tiptap/extension-youtube": "^2.0.3",
"@tiptap/pm": "^2.0.3", "@tiptap/pm": "^2.0.3",
@ -7348,6 +7349,19 @@
"@tiptap/core": "^2.0.0" "@tiptap/core": "^2.0.0"
} }
}, },
"node_modules/@tiptap/extension-placeholder": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@tiptap/extension-placeholder/-/extension-placeholder-2.0.3.tgz",
"integrity": "sha512-Z42jo0termRAf0S0L8oxrts94IWX5waU4isS2CUw8xCUigYyCFslkhQXkWATO1qRbjNFLKN2C9qvCgGf4UeBrw==",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/ueberdosis"
},
"peerDependencies": {
"@tiptap/core": "^2.0.0",
"@tiptap/pm": "^2.0.0"
}
},
"node_modules/@tiptap/extension-strike": { "node_modules/@tiptap/extension-strike": {
"version": "2.0.3", "version": "2.0.3",
"resolved": "https://registry.npmjs.org/@tiptap/extension-strike/-/extension-strike-2.0.3.tgz", "resolved": "https://registry.npmjs.org/@tiptap/extension-strike/-/extension-strike-2.0.3.tgz",

View file

@ -30,6 +30,7 @@
"@tiptap/extension-highlight": "^2.0.3", "@tiptap/extension-highlight": "^2.0.3",
"@tiptap/extension-link": "^2.0.3", "@tiptap/extension-link": "^2.0.3",
"@tiptap/extension-mention": "^2.0.3", "@tiptap/extension-mention": "^2.0.3",
"@tiptap/extension-placeholder": "^2.0.3",
"@tiptap/extension-typography": "^2.0.3", "@tiptap/extension-typography": "^2.0.3",
"@tiptap/extension-youtube": "^2.0.3", "@tiptap/extension-youtube": "^2.0.3",
"@tiptap/pm": "^2.0.3", "@tiptap/pm": "^2.0.3",

View file

@ -1,4 +1,5 @@
import { appWithTranslation } from 'next-i18next' import { appWithTranslation } from 'next-i18next'
import Head from 'next/head'
import Link from 'next/link' import Link from 'next/link'
import { useTranslation } from 'next-i18next' import { useTranslation } from 'next-i18next'
import { get } from 'local-storage' import { get } from 'local-storage'
@ -131,20 +132,28 @@ function MyApp({ Component, pageProps }: AppProps) {
} }
return ( return (
<ThemeProvider> <>
<ToastProvider swipeDirection="right"> <Head>
<TooltipProvider> <meta
<Layout> name="viewport"
{!appState.version ? ( content="viewport-fit=cover, width=device-width, initial-scale=1.0"
serverUnavailable() />
) : ( </Head>
<Component {...pageProps} /> <ThemeProvider>
)} <ToastProvider swipeDirection="right">
</Layout> <TooltipProvider>
<Viewport className="ToastViewport" /> <Layout>
</TooltipProvider> {!appState.version ? (
</ToastProvider> serverUnavailable()
</ThemeProvider> ) : (
<Component {...pageProps} />
)}
</Layout>
<Viewport className="ToastViewport" />
</TooltipProvider>
</ToastProvider>
</ThemeProvider>
</>
) )
} }

View file

@ -90,8 +90,8 @@ const PartyRoute: React.FC<Props> = ({
break break
} }
if (router.asPath !== '/new' && router.asPath !== '/') // if (router.asPath !== '/new' && router.asPath !== '/')
router.replace(path, undefined, { shallow: true }) // router.replace(path, undefined, { shallow: true })
} }
// Set the initial data from props // Set the initial data from props

View file

@ -557,6 +557,19 @@
"tokens": { "tokens": {
"remix": "Remixed" "remix": "Remixed"
}, },
"toolbar": {
"tooltips": {
"bold": "Bold",
"italic": "Italic",
"strike": "Strikethrough",
"highlight": "Highlight",
"link": "Add a link",
"youtube": "Add a Youtube video",
"heading": "Heading {{level}}",
"bulletList": "Bullet list",
"orderedList": "Numbered list"
}
},
"tooltips": { "tooltips": {
"copy_url": "Copy the URL to this team", "copy_url": "Copy the URL to this team",
"new": "Create a new team", "new": "Create a new team",

View file

@ -555,6 +555,19 @@
"tokens": { "tokens": {
"remix": "リミックスされた" "remix": "リミックスされた"
}, },
"toolbar": {
"tooltips": {
"bold": "太字",
"italic": "斜体",
"strike": "取り消し線",
"highlight": "ハイライト",
"link": "リンクを挿入",
"youtube": "Youtube動画を埋め込む",
"heading": "見出し {{level}}",
"bulletList": "箇条書き",
"orderedList": "番号リスト"
}
},
"tooltips": { "tooltips": {
"copy_url": "この編成のURLをコピーする", "copy_url": "この編成のURLをコピーする",
"new": "新しい編成を作成する", "new": "新しい編成を作成する",

View file

@ -159,6 +159,14 @@
--grid-border-color: #{$grid--border--color--light}; --grid-border-color: #{$grid--border--color--light};
// Light - Element theming // Light - Element theming
--null-bg: #{$null--bg--light};
--null-bg-hover: #{$null--bg--hover--light};
--null-text: #{$null--text--light};
--null-raid-text: #{$null--text--raid--light};
--null-text-hover: #{$null--text--hover--light};
--null-shadow: #{$null--shadow--light};
--null-shadow-hover: #{$null--shadow--light--hover};
--wind-bg: #{$wind--bg--light}; --wind-bg: #{$wind--bg--light};
--wind-bg-hover: #{$wind--bg--hover--light}; --wind-bg-hover: #{$wind--bg--hover--light};
--wind-text: #{$wind--text--light}; --wind-text: #{$wind--text--light};
@ -373,6 +381,14 @@
--grid-border-color: #{$grid--border--color--dark}; --grid-border-color: #{$grid--border--color--dark};
// Dark - Element theming // Dark - Element theming
--null-bg: #{$null--bg--dark};
--null-bg-hover: #{$null--bg--hover--dark};
--null-text: #{$null--text--dark};
--null-raid-text: #{$null--text--raid--dark};
--null-text-hover: #{$null--text--hover--dark};
--null-shadow: #{$null--shadow--dark};
--null-shadow-hover: #{$null--shadow--dark--hover};
--wind-bg: #{$wind--bg--dark}; --wind-bg: #{$wind--bg--dark};
--wind-bg-hover: #{$wind--bg--hover--dark}; --wind-bg-hover: #{$wind--bg--hover--dark};
--wind-text: #{$wind--text--dark}; --wind-text: #{$wind--text--dark};

View file

@ -464,6 +464,28 @@ $wind--shadow--dark: fade-out($wind-text-20, 0.3);
$wind--shadow--light--hover: fade-out($wind-text-00, 0.3); $wind--shadow--light--hover: fade-out($wind-text-00, 0.3);
$wind--shadow--dark--hover: fade-out($wind-text-00, 0.3); $wind--shadow--dark--hover: fade-out($wind-text-00, 0.3);
// Color Definitions: Element / Null
$null--bg--light: $grey-75;
$null--bg--dark: $grey-40;
$null--bg--hover--light: $grey-70;
$null--bg--hover--dark: $grey-30;
$null--text--light: $grey-40;
$null--text--dark: $grey-90;
$null--text--raid--light: $grey-40;
$null--text--raid--dark: $grey-90;
$null--text--hover--light: $grey-20;
$null--text--hover--dark: $grey-90;
$null--shadow--light: fade-out($grey-60, 0.3);
$null--shadow--dark: fade-out($grey-25, 0.3);
$null--shadow--light--hover: fade-out($grey-50, 0.3);
$null--shadow--dark--hover: fade-out($grey-10, 0.3);
// Color Definitions: Element / Fire // Color Definitions: Element / Fire
$fire--bg--light: $fire-bg-10; $fire--bg--light: $fire-bg-10;
$fire--bg--dark: $fire-bg-10; $fire--bg--dark: $fire-bg-10;

View file

@ -179,6 +179,17 @@ class Api {
} }
}) })
} }
updateTranscendence(resource: 'character'|'summon', id: string, value: number) {
const pluralized = resource + 's'
const resourceUrl = `${this.url}/${pluralized}/update_uncap`
return axios.post(resourceUrl, {
[resource]: {
id: id,
transcendence_step: value
}
})
}
userInfo(id: string) { userInfo(id: string) {
const resourceUrl = `${this.url}/users/info/${id}` const resourceUrl = `${this.url}/users/info/${id}`