b422765aed
* tweak in-post threadgate button * tweak composer threadgate button * reduce date length slightly * pressed styles * make date length depend on breakpoint * add chevron to label btn * add tiny chevron, special-case button icon width * [Threadgate] Add hint (#9350) * get tooltip working on web * add compatibility layer for working in iOS sheets * add timeout to profile tooltip now that it appears instantly * rm debug code * Update ThreadgateBtn.tsx Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * remeasure when keyboard changes --------- Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * fix types * [Threadgate] Refresh dialog (#9342) * wip new ui * update threadgate dialog with new designs * restore nobody option * relayout android sheet when ratio changes * fix ratio changing case in bottom sheet * timebox reached, use setTimeout * update panel styles * missing imports * extract out Panel * tweak layout animation * fix icon color * use same color mechamism for icon as text * restore the header * refreshed toggle styles (#9343) * [Threadgate] Persist settings (#9341) * add persist toggle to threadgate dialog * move state back down * sort out spacing * wire up query * @surfdude29 tweaks * use tiny chevron in WhoCanReply * wait for prefetch before opening * move Panel into the Toggle namespace * default -> pref * use medium date length * rm hover state from web selects, fix border radius * fix key issue in Selects --------- Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com>
#/storage
Usage
Import the correctly scoped store from #/storage. Each instance of Storage
(the base class, not to be used directly), has the following interface:
set([...scope, key], value)get([...scope, key])remove([...scope, key])removeMany([...scope], [...keys])
For example, using our device store looks like this, since it's scoped to the
device (the most base level scope):
import { device } from '#/storage';
device.set(['foobar'], true);
device.get(['foobar']);
device.remove(['foobar']);
device.removeMany([], ['foobar']);
TypeScript
Stores are strongly typed, and when setting a given value, it will need to
conform to the schemas defined in #/storage/schema. When getting a value, it
will be returned to you as the type defined in its schema.
Scoped Stores
Some stores are (or might be) scoped to an account or other identifier. In this case, storage instances are created with type-guards, like this:
type AccountSchema = {
language: `${string}-${string}`;
};
type DID = `did:${string}`;
const account = new Storage<
[DID],
AccountSchema
>({
id: 'account',
});
account.set(
['did:plc:abc', 'language'],
'en-US',
);
const language = account.get([
'did:plc:abc',
'language',
]);
Here, if ['did:plc:abc'] is not supplied along with the key of
language, the get will return undefined (and TS will yell at you).