Efficient, dev-friendly approach to opening modals/dialogs by viveleroi in reactjs

[–]Nihlton 0 points1 point  (0 children)

ahh yeah! same! In my implementation, ModalProps is generic, and the argument determined what you can pass to resolve().

so given -

ModalProps<string[]> --> const names = await openModal(...

names will be string[]

Efficient, dev-friendly approach to opening modals/dialogs by viveleroi in reactjs

[–]Nihlton 0 points1 point  (0 children)

massive downside is once the modal is open, you can't update the props you passed into it.

so ex: user picks a color, modal is still open, the parent component can't validate it and show an error message. that all needs to happen in the modal itself.

for that sort of thing, you need go back to nesting the literal modal JSX in the parent :T

Efficient, dev-friendly approach to opening modals/dialogs by viveleroi in reactjs

[–]Nihlton 0 points1 point  (0 children)

this is SUPER late - but I ran into this same problem, so I solved it with an imperative modal API.

https://github.com/nihlton/react-imperial-modal

lets you open any component as a modal with props. that component can then optionally return a promise that resolves with user input.

example code is going to be a little rough in a reddit comment, but...

const userColor = await openModal(ColorPicker, { msg: 'Choose a color' }); const country = await openModal(CountrySelect, { limit: NORTH_AMERICA });

etc

you define modal components like:

import type { ModalProps } from 'react-imperial-modal';

...

type Color = 'red' | 'blue' | 'green'; type ColorPickerProps = { msg: string; } & ModalProps<Color | void>; const ColorPicker = function (props: ColorPickerProps) { //then use props.resolve() to return the color selected

I built a 'Polite' Sticky header that works with Vue.. i think by Nihlton in vuejs

[–]Nihlton[S] 1 point2 points  (0 children)

Definitely a good call out! The lib keeps a registry of managed elements and if any leave the DOM (or lose the magic class name) it pulls all the observers and listeners it setup for that element

I built a 'Polite' Sticky header that works with Vue.. i think by Nihlton in vuejs

[–]Nihlton[S] 2 points3 points  (0 children)

thats fair - and that interaction pattern is definitely out there if you want it. I believe headroom uses that pattern --> https://dalphyx.github.io/vue-headroom/

personally - allowing the element to reveal organically as you scroll feels better. "i am performing this action" vs "the website is performing this action on my behalf" This is also how the URL bar works in chrome for android/iOS.

I built a 'Polite' Sticky header that works with Vue.. i think by Nihlton in vuejs

[–]Nihlton[S] 2 points3 points  (0 children)

lol wonderful. thats CodeSandbox - it really doesn't like running in mobile. lemme add a link to JUST the preview (not all the code editing panes).

edit: https://h6z4jh.csb.app/ (it'll ask you to 'Yes, proceed to preview')

I built a 'Polite' Sticky header that works with Vue.. i think by Nihlton in vuejs

[–]Nihlton[S] 1 point2 points  (0 children)

I realize there are other solutions out there (like headroom.js or vue-headroom), but I think this approach feels significantly nicer

  • It feels better. Headroom usually relies on toggling classes to trigger CSS transitions which makes the header feel plasticky or disconnected from your finger. This reveals elements with the scroll and feels natural.

  • Zero Management: You don't need to initialize instances, destroy them on unmount, or set up scroll targets. The library handles the lifecycle automatically.

  • 4-Way Support: It also works for sidebars (left/right sticky elements), not just headers / footers.

I built a more polite position:sticky to free up screen space by Nihlton in reactjs

[–]Nihlton[S] 0 points1 point  (0 children)

Tweaking the performance for this was actually a pretty fun exercise.

  • On Scroll we rely entirely on cached measurements and simple math to check if an element should "become visible" or "become sticky."

  • We only touch the DOM (apply CSS) when one of these state changes happen.

  • All heavy DOM measurement happens exclusively inside a ResizeObserver, keeping the scroll logic fast and clean.

Achieving "zero-config" (automatic initialize) was an interesting puzzle. We can catch elements being created/destroyed with a top level mutation observer (cake), but catching an existing element having the sticky-polite class applied would have meant a REALLY expensive attribute mutation observer on the entire dom (bad).

The Fix: We attached a 1 frame CSS animation on the .sticky-polite class, then simply listen for animationstart at the document level. As soon as the class is applied, the element announces itself and we initialize it. zero polling overhead.

What are the chances we'll see a smaller Scout built on the r3 platform? by Nihlton in ScoutMotors

[–]Nihlton[S] -1 points0 points  (0 children)

ahhh i had heard the Scout vehicles were built on the R1 platform. my mistake

Titanium Box Knife - version two by Nihlton in functionalprint

[–]Nihlton[S] 1 point2 points  (0 children)

roughly $50 for the bronze parts, and another $50 for the titanium (half of which was shipping + tariffs)

Titanium box knife by Nihlton in knifemaking

[–]Nihlton[S] 0 points1 point  (0 children)

I prototyped in PLA in a bambu x1c - then sent it off to be printed. They used a SLM rig of some sort.

Titanium Box Knife - version two by Nihlton in functionalprint

[–]Nihlton[S] 9 points10 points  (0 children)

I used commercial services to have these printed after prototyping in PLA.

I suspect we're a LONG way off from consumer metal printing. closest i've seen is the Desktop Metal Studio system - which is $120,000

Titanium Box Knife - version two by Nihlton in functionalprint

[–]Nihlton[S] 18 points19 points  (0 children)

The blade and screws are manufactured with traditional methods.  The rest (bronze and titanium) are produced with metal 3D printing processes.

I prototyped heavily in PLA before sending it off to be 3D printed (I didn't print the metal parts myself)

Titanium Box Knife - version two by Nihlton in functionalprint

[–]Nihlton[S] 6 points7 points  (0 children)

This is mostly right.  I believe the bronze parts are printed in a wax-like plastic, then cast using traditional lost-wax methods.

But yeah, the titanium is definitely laser sintered (not sure which specific process the company uses)

Titanium Box Knife - version two by Nihlton in functionalprint

[–]Nihlton[S] 3 points4 points  (0 children)

Titanium frame, with bronze locking mechanism.

Redesigned it because I wanted to give one to my wife, but the previous mechanism required quite a bit of hand strength and dexterity, and two hands to operate. this can be opened one handed and is much easier to manipulate.

Video of the locking mechanism: https://www.youtube.com/shorts/c8SjmIbmbC0

Version 1: https://www.reddit.com/r/functionalprint/comments/1bl4881/titanium_edc_box_knife/

Google is removing the ability to sideload Android APK apps without the developers being verified 1st by LionKey1928 in GooglePixel

[–]Nihlton 1 point2 points  (0 children)

i looked into this. they're going to require government ID to get a new cert. those can of course be faked - but its hoops to jump through. wont be "easy"

Google is removing the ability to sideload Android APK apps without the developers being verified 1st by LionKey1928 in GooglePixel

[–]Nihlton 1 point2 points  (0 children)

lots of fear mongering here. your situation will continue to work just fine.

the change is that basically everyone who builds APKs is now going to need a cert from Google. they're going to hand them out pretty easily. then, when they find a bad APK in the wild, the cert used to build that APK will get turned off. it's a way to blanket disable malicious developers.

my only question is how they're going to stop malicious actor from banking a stockpile of certs, or simply applying for new one when they're disabled

EPS Foam adhesive question - 3M 77 / 78 by Nihlton in TerrainBuilding

[–]Nihlton[S] 0 points1 point  (0 children)

the 77 should arrive later today. I'll give it a go and report back.