Skip to content
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

Adding Future Gachas/Future Events to a new tab for EN, KR, and TW ease of access #512

Open
wants to merge 12 commits into
base: dev
Choose a base branch
from

Conversation

Icequeen3333
Copy link

Description

Creating two new pages, one called Future Gacha, one called Future Event. These show events and gachas, starting from one year ago today on JP, in ascending order, only if spoiler tag is enabled. If the tag is not, it will show events on jp from ascending order (I didn't know what to do in this case, if any maintainer would have any other preferences as to what it should start at, I'd be willing to edit it.)

Related Issue

Adding Future Gacha/Future Event

Motivation and Context

Ease of access, we're three years into this game at this point, scrolling through all of the gachas and events to find out when a lim is getting reran or when an event you've been saving for will come back is extremely tedious, this is simply for ease of access.

How Has This Been Tested?

  • Chrome (Desktop)
  • Chrome (Mobile)
  • Firefox (Desktop)
  • Firefox (Mobile)
  • Safari (Desktop, optional)
  • Safari (iPhone, optional)
  • Safari (iPad, optional)

Screenshots (if appropriate):

image

@Icequeen3333
Copy link
Author

Still running some tests, so please don't merge it yet, theres something with futureevent that I'm trying to debug right now

Copy link
Contributor

@dnaroma dnaroma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still many small problems. For the folder structure, I would suggest rename folder src/pages/futureevent to src/pages/future since you put all future things in it.

icon: <MoveToInboxIcon></MoveToInboxIcon>,
text: t("common:futuregacha"),
to: "/futuregacha",
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer the future variants in a single menu item with children, I can do it after merge if you want

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove it

settings: { isShowSpoiler, region },
} = useRootStore();

function useCachedData<T extends IEventInfo>(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not extend here, extend the function in utils/index.ts


function useCachedData<T extends IEventInfo>(
name: string,
useRegion: ServerRegion = region
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In React, use is considered as a reversed keyword for hooks

"jp" as ServerRegion
);

console.log("b");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove console.log

@@ -434,12 +437,24 @@ const DrawerContent: React.FC<{
text: t("common:music"),
to: "/music",
},
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hide if !isShowSpoiler?

{
disabled: false,
icon: <MoveToInboxIcon></MoveToInboxIcon>,
text: t("common:gacha"),
to: "/gacha",
},
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hide if !isShowSpoiler?

icon: <CalendarText></CalendarText>,
text: t("common:futureevent"),
to: "/futureevent",
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer the future variants in a single menu item with children, I can do it after merge if you want

setEvents([]);
setPage(0);
// needed otherwise lint starts complaining that updateSortBy is there and isnt there at the same time
// eslint-disable-next-line react-hooks/exhaustive-deps
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed and it is fine for me


return (
// kinda a brute forced way of doing it tbh, but I just removed the path and set it to send to gacha
<Link to={"gacha/" + data.id} style={{ textDecoration: "none" }}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link won't work well because most of the future gachas exist only in JP

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will consider add region to path params, or can be forced as a query param

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alrighty, I saw that problem with the events when I was testing, I could try and make a futureGacha page as well where it gets the jp events with similar logic to the other functions?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alrighty, I saw that problem with the events when I was testing, I could try and make a futureGacha page as well where it gets the jp events with similar logic to the other functions?

That's not necessary

(e) => e.startAt >= new Date().getTime() - 31556952000
);
}
if (!isShowSpoiler) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By this you mean setting sorted cache to just being an empty array and then breaking?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if isShowSpoiler is false, it means no spoiler should be shown, so it is meaningless to have if (!isShowSpoiler) branch here, or I misunderstood it

let sortedCache = [...eventsCache];
if (isShowSpoiler) {
sortedCache = sortedCache.filter(
(e) => e.startAt >= new Date().getTime() - 31556952000
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I think I explained it in a past push and then deleted it, its a year worth of milliseconds

It would be better to compare against the latest running event/gacha

(e) => e.startAt >= new Date().getTime() - 31556952000
);
}
if (!isShowSpoiler) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if isShowSpoiler is false, it means no spoiler should be shown, so it is meaningless to have if (!isShowSpoiler) branch here, or I misunderstood it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants