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

feat: carousel integration with history navigation #1601

Closed
Closed
Changes from 2 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
8745e4a
feat: carousel integration with history navigation
aegroto Nov 18, 2024
4239f9a
Merge branch 'master' of github.com:stackernews/stacker.news into enh…
aegroto Nov 21, 2024
ec2ab58
Merge branch 'master' into enhancement-backward-carousel-images
huumn Nov 21, 2024
c691259
Merge branch 'master' of github.com:stackernews/stacker.news into enh…
aegroto Nov 21, 2024
a7a16e4
Merge branch 'enhancement-backward-carousel-images' of github.com:aeg…
aegroto Nov 21, 2024
3be1418
fix: navigation-based carousel close action
aegroto Nov 22, 2024
3d2063a
Use invoice.cancelledAt to determine if invoice expired or was cancel…
ekzyis Nov 22, 2024
7d0eb60
add in error message how high are estimated fees when too high (#1634)
riccardobl Nov 22, 2024
b8dd4c4
fix LNC attachment and docs (#1639)
riccardobl Nov 23, 2024
6b44b14
Remove unused function usePayment (#1641)
ekzyis Nov 23, 2024
0039700
refactor: Check darkmode in useWallets (#1640)
ekzyis Nov 23, 2024
4aba93f
Only fetch logs when we need them (#1638)
ekzyis Nov 24, 2024
ad4644f
Create useWalletStatus and useWalletSupport (#1646)
ekzyis Nov 24, 2024
2bed712
Fix inconsistent actionArgs on retry (#1651)
ekzyis Nov 26, 2024
971b510
direct receives and send paid action (#1650)
huumn Nov 27, 2024
57a30a4
Wallet filters (#1627)
ekzyis Nov 27, 2024
5c3ca67
use flexbox for wallet card header and make logos more consistent (#1…
riccardobl Nov 27, 2024
b7fd9e2
Improve LNC realiability by being nicer (#1658)
riccardobl Nov 27, 2024
e30185e
fix: cannot add images above text (#1659)
Soxasora Nov 27, 2024
3a7e1d9
Remove unused useWallet from QR code component (#1660)
ekzyis Nov 27, 2024
6f1dabb
Fix deposit push notifications (#1662)
ekzyis Nov 28, 2024
acdfdb2
Fix comment
ekzyis Nov 24, 2024
d42dc91
sender fallbacks
ekzyis Nov 25, 2024
2b20cfa
Fix SenderError name
ekzyis Nov 26, 2024
4b39e98
Fix TypeError
ekzyis Nov 26, 2024
8976b30
Fix old invoice passed to QR code
ekzyis Nov 26, 2024
0911ec3
Remove unnecessary sort
ekzyis Nov 26, 2024
b860a57
Fix payments if recv-only wallet enabled
ekzyis Nov 26, 2024
1ddc4fa
Refactor wallet error handling with inheritance
ekzyis Nov 26, 2024
c49b6f8
Abort payment on unexpected errors
ekzyis Nov 26, 2024
6b4dbed
Add comment when err.newInvoice is not set
ekzyis Nov 26, 2024
b562412
Ignore wallet configuration errors in QR code
ekzyis Nov 26, 2024
2f1833c
Fix last wallet not returning new invoice
ekzyis Nov 26, 2024
2bd928d
Allow retries of pessimistic actions
ekzyis Nov 26, 2024
f011bbc
Fix payment method returned by retries
ekzyis Nov 26, 2024
748cc22
Show aggregated wallet errors in QR code
ekzyis Nov 26, 2024
250b64b
Return last attempted invoice in canceled state
ekzyis Nov 27, 2024
16a28c9
Fix filter for wallets that can send
ekzyis Nov 27, 2024
2b64fef
Fix invoice retry even if no payment was attempted
ekzyis Nov 27, 2024
85ece35
Fix missing item invoice update for optimistic actions
ekzyis Nov 27, 2024
f4426bb
Remove unnecessary error handling in LNC
ekzyis Nov 27, 2024
744602f
Return latest state of paid or failed invoice
ekzyis Nov 27, 2024
e24e118
Create wrapped invoices on p2p zap retries
ekzyis Nov 27, 2024
b1f064d
Only retry same receiver if forward did not fail
ekzyis Nov 27, 2024
f2e1806
refactor out array of hooks
huumn Nov 27, 2024
ded2096
Fix wallet save
ekzyis Nov 28, 2024
de598c1
Fix [undefined] in logs
ekzyis Nov 28, 2024
bb9fc60
readability improvements
huumn Nov 28, 2024
9574cd2
Fix missing item invoice update on failure
ekzyis Nov 28, 2024
fda130a
make logger use full wallet
huumn Nov 28, 2024
4f05a9e
usesendwallets
huumn Nov 28, 2024
9ea9352
fix zap fallback retries in notifications
huumn Nov 28, 2024
0abbc6b
make fallback retry cache updates a special case
huumn Nov 28, 2024
0774b67
function for merging data after retry
huumn Nov 28, 2024
f5ea386
fix cache update option name on qr
huumn Nov 28, 2024
91aa1f6
feat: recent unpaid bounties selection (#1589)
aegroto Nov 29, 2024
fc9b8f0
Fix Territories selector updates without hard-reload (#1619)
aegroto Nov 30, 2024
d63f466
Introduce SubPopover (#1620)
felipebueno Nov 30, 2024
d890ab7
Fix missing authentication check for invite revocation (#1666)
ekzyis Nov 30, 2024
7ef6fd2
Fix: progress bar shown on back navigation through pathname check (#1…
aegroto Dec 1, 2024
aff5f8d
fix: top boosts shows others' unpaid boosts (#1647)
Soxasora Dec 1, 2024
6c86b39
fix can't upload from iOS camera/mov files (#1667)
Soxasora Dec 1, 2024
6abe6ea
Custom invite code and note (#1649)
riccardobl Dec 1, 2024
42da56e
stop probable source of 504 toasts
huumn Dec 1, 2024
107aefd
Dockerfile update
aegroto Dec 2, 2024
977d4dd
fix: fixed dockerfile
aegroto Dec 3, 2024
e50caa2
chore: removed commented dockerfile
aegroto Dec 3, 2024
edd83a1
feat: bundle action scaffolding
aegroto Dec 3, 2024
c953638
fix: added environment set-up on bundle action
aegroto Dec 3, 2024
42a25e0
chore: printing environment in action
aegroto Dec 3, 2024
a74ea83
fix: changed base CI image and fixed environment creation
aegroto Dec 3, 2024
8f0db77
chore: restore base ubuntu image
aegroto Dec 3, 2024
c7b4054
fix: test VAPID keys with the right bytes count
aegroto Dec 3, 2024
7eaed29
fix: using actually generated VAPID keys
aegroto Dec 3, 2024
f5a67ac
chore: temporarily disabled compare steps
aegroto Dec 3, 2024
de3562f
Revert "chore: temporarily disabled compare steps"
aegroto Dec 3, 2024
999846b
Fix edit timer stuck at 00:00 (#1673)
ekzyis Dec 2, 2024
e2d5380
item referral threshold
huumn Dec 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions components/carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import ArrowRight from '@/svgs/arrow-right-line.svg'
import styles from './carousel.module.css'
import { useShowModal } from './modal'
import { Dropdown } from 'react-bootstrap'
import { usePathname } from 'next/navigation'

function useSwiping ({ moveLeft, moveRight }) {
const [touchStartX, setTouchStartX] = useState(null)
Expand Down Expand Up @@ -104,10 +105,14 @@ function CarouselOverflow ({ originalSrc, rel }) {
}

export function CarouselProvider ({ children }) {
const pathname = usePathname()

const media = useRef(new Map())
const showModal = useShowModal()

const showCarousel = useCallback(({ src }) => {
window.history.pushState(null, '', pathname)
Copy link
Member

@ekzyis ekzyis Nov 21, 2024

Choose a reason for hiding this comment

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

This isn't a shallow push. On backwards navigation, this closes the carousel by reloading the page. We do not want to reload the page, we only want to close the carousel on backwards navigation.

Mhh, on closer inspection, maybe this doesn't trigger a page reload on backward navigation so this could be fine. However, I am still curious why you couldn't use next/router.

I wasn't able to use router.push as suggested in the original issue

Why not?


You also need to pop the state again on close since else, manually closing an image will mean that your next backward navigation will do nothing except popping that stale state.

So if I open many images and close all of them myself, I need to click back as many times as I opened images before I actually go back.

Copy link
Contributor Author

@aegroto aegroto Nov 21, 2024

Choose a reason for hiding this comment

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

I have not been able to use router.push because it was not updating the history anyway. I don't know the reason, but I believe it may be related to the path being identical to the last one, and I guess the router drops duplicate entries. An alternative would be to use a different URL, but this hinders the modal to be opened, I still have to investigate this behaviour.

I didn't understand that the push had to be unique for the entire carousel. I will work on this as soon as possible.

Copy link
Member

Choose a reason for hiding this comment

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

Adding a query param might work:

router.push({ pathname: router.pathname, query: { carousel: true, ...router.query}}, router.asPath, { shallow: true }}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's what I've been trying to do but it looks like the carousel is immediately closed after a 'router.push' or 'router.replace' call. This does not happen when calling native `window' APIs though.

Copy link
Member

Choose a reason for hiding this comment

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

If you used shallow: true and it did that, then I'd guess something is rerendering that shouldn't.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe this is due to line 73 of modal.js:

router.events.on('routeChangeStart', maybeOnClose)

The push call triggers this event, which then calls maybeOnClose. This makes sense as the native window API is not trigger router's events.


showModal((close, setOptions) => {
return <Carousel close={close} mediaArr={Array.from(media.current.entries())} src={src} setOptions={setOptions} />
}, {
Expand Down
Loading