1
0
forked from Kieran/snort

feat: use notes instead of posts

This commit is contained in:
Kieran 2023-06-11 11:21:19 +02:00
parent 203f5f2841
commit d50787e3f2
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
8 changed files with 34 additions and 31 deletions

View File

@ -195,6 +195,15 @@ export class MultiAccountStore extends ExternalStore<LoginSession> {
window.localStorage.removeItem(LegacyKeys.RelayListKey); window.localStorage.removeItem(LegacyKeys.RelayListKey);
window.localStorage.removeItem(LegacyKeys.FollowList); window.localStorage.removeItem(LegacyKeys.FollowList);
window.localStorage.removeItem(LegacyKeys.NotificationsReadItem); window.localStorage.removeItem(LegacyKeys.NotificationsReadItem);
// replace default tab with notes
for (const [, v] of this.#accounts) {
if ((v.preferences.defaultRootTab as string) === "posts") {
v.preferences.defaultRootTab = "notes";
didMigrate = true;
}
}
if (didMigrate) { if (didMigrate) {
console.debug("Finished migration to MultiAccountStore"); console.debug("Finished migration to MultiAccountStore");
this.#save(); this.#save();

View File

@ -55,7 +55,7 @@ export interface UserPreferences {
/** /**
* Default page to select on load * Default page to select on load
*/ */
defaultRootTab: "posts" | "conversations" | "global"; defaultRootTab: "notes" | "conversations" | "global";
/** /**
* Default zap amount * Default zap amount
@ -79,7 +79,7 @@ export const DefaultPreferences = {
autoShowLatest: false, autoShowLatest: false,
fileUploader: "void.cat", fileUploader: "void.cat",
imgProxyConfig: DefaultImgProxy, imgProxyConfig: DefaultImgProxy,
defaultRootTab: "posts", defaultRootTab: "notes",
defaultZapAmount: 50, defaultZapAmount: 50,
autoZap: false, autoZap: false,
} as UserPreferences; } as UserPreferences;

View File

@ -25,12 +25,12 @@ export default function RootPage() {
const { publicKey: pubKey, tags, preferences } = useLogin(); const { publicKey: pubKey, tags, preferences } = useLogin();
const RootTab: Record<string, Tab> = { const RootTab: Record<string, Tab> = {
Posts: { Notes: {
text: formatMessage(messages.Posts), text: formatMessage(messages.Notes),
value: 0, value: 0,
data: "/posts", data: "/notes",
}, },
PostsAndReplies: { Conversations: {
text: formatMessage(messages.Conversations), text: formatMessage(messages.Conversations),
value: 1, value: 1,
data: "/conversations", data: "/conversations",
@ -50,7 +50,7 @@ export default function RootPage() {
const tagTabs = tags.item.map((t, idx) => { const tagTabs = tags.item.map((t, idx) => {
return { text: `#${t}`, value: idx + 3, data: `/tag/${t}` }; return { text: `#${t}`, value: idx + 3, data: `/tag/${t}` };
}); });
const tabs = [RootTab.Posts, RootTab.PostsAndReplies, RootTab.Global, RootTab.Discover, ...tagTabs]; const tabs = [RootTab.Notes, RootTab.Conversations, RootTab.Global, RootTab.Discover, ...tagTabs];
const tab = useMemo(() => { const tab = useMemo(() => {
const pTab = location.pathname.split("/").slice(-1)[0]; const pTab = location.pathname.split("/").slice(-1)[0];
@ -64,7 +64,7 @@ export default function RootPage() {
switch (pTab) { switch (pTab) {
case "conversations": { case "conversations": {
return RootTab.PostsAndReplies; return RootTab.NotesAndReplies;
} }
case "global": { case "global": {
return RootTab.Global; return RootTab.Global;
@ -73,7 +73,7 @@ export default function RootPage() {
return RootTab.Discover; return RootTab.Discover;
} }
default: { default: {
return RootTab.Posts; return RootTab.Notes;
} }
} }
}, [location]); }, [location]);
@ -195,7 +195,7 @@ const GlobalTab = () => {
); );
}; };
const PostsTab = () => { const NotesTab = () => {
const { follows, publicKey } = useLogin(); const { follows, publicKey } = useLogin();
const subject: TimelineSubject = { const subject: TimelineSubject = {
type: "pubkey", type: "pubkey",
@ -239,8 +239,8 @@ export const RootRoutes = [
element: <GlobalTab />, element: <GlobalTab />,
}, },
{ {
path: "posts", path: "notes",
element: <PostsTab />, element: <NotesTab />,
}, },
{ {
path: "conversations", path: "conversations",

View File

@ -2,7 +2,6 @@ import { defineMessages } from "react-intl";
export default defineMessages({ export default defineMessages({
Login: { defaultMessage: "Login" }, Login: { defaultMessage: "Login" },
Posts: { defaultMessage: "Posts" },
Conversations: { defaultMessage: "Conversations" }, Conversations: { defaultMessage: "Conversations" },
Global: { defaultMessage: "Global" }, Global: { defaultMessage: "Global" },
NewUsers: { defaultMessage: "New users page" }, NewUsers: { defaultMessage: "New users page" },

View File

@ -115,8 +115,8 @@ const PreferencesPage = () => {
defaultRootTab: e.target.value, defaultRootTab: e.target.value,
} as UserPreferences) } as UserPreferences)
}> }>
<option value="posts"> <option value="notes">
<FormattedMessage {...messages.Posts} /> <FormattedMessage defaultMessage="Notes" />
</option> </option>
<option value="conversations"> <option value="conversations">
<FormattedMessage {...messages.Conversations} /> <FormattedMessage {...messages.Conversations} />

View File

@ -16,12 +16,11 @@ export default defineMessages({
Light: { defaultMessage: "Light" }, Light: { defaultMessage: "Light" },
Dark: { defaultMessage: "Dark" }, Dark: { defaultMessage: "Dark" },
DefaultRootTab: { defaultMessage: "Default Page" }, DefaultRootTab: { defaultMessage: "Default Page" },
Posts: { defaultMessage: "Posts" },
Conversations: { defaultMessage: "Conversations" }, Conversations: { defaultMessage: "Conversations" },
Global: { defaultMessage: "Global" }, Global: { defaultMessage: "Global" },
AutoloadMedia: { defaultMessage: "Automatically load media" }, AutoloadMedia: { defaultMessage: "Automatically load media" },
AutoloadMediaHelp: { AutoloadMediaHelp: {
defaultMessage: "Media in posts will automatically be shown for selected people, otherwise only the link will show", defaultMessage: "Media in notes will automatically be shown for selected people, otherwise only the link will show",
}, },
None: { defaultMessage: "None" }, None: { defaultMessage: "None" },
FollowsOnly: { defaultMessage: "Follows only" }, FollowsOnly: { defaultMessage: "Follows only" },
@ -38,7 +37,7 @@ export default defineMessages({
ConfirmReposts: { defaultMessage: "Confirm Reposts" }, ConfirmReposts: { defaultMessage: "Confirm Reposts" },
ConfirmRepostsHelp: { defaultMessage: "Reposts need to be manually confirmed" }, ConfirmRepostsHelp: { defaultMessage: "Reposts need to be manually confirmed" },
ShowLatest: { defaultMessage: "Automatically show latest notes" }, ShowLatest: { defaultMessage: "Automatically show latest notes" },
ShowLatestHelp: { defaultMessage: "Notes will stream in real time into global and posts tab" }, ShowLatestHelp: { defaultMessage: "Notes will stream in real time into global and notes tab" },
FileUpload: { defaultMessage: "File upload service" }, FileUpload: { defaultMessage: "File upload service" },
FileUploadHelp: { defaultMessage: "Pick which upload service you want to upload attachments to" }, FileUploadHelp: { defaultMessage: "Pick which upload service you want to upload attachments to" },
Default: { defaultMessage: "(Default)" }, Default: { defaultMessage: "(Default)" },

View File

@ -326,9 +326,6 @@
"DqLx9k": { "DqLx9k": {
"defaultMessage": "You must pay {n} sats to access this file." "defaultMessage": "You must pay {n} sats to access this file."
}, },
"Dt/Zd5": {
"defaultMessage": "Media in posts will automatically be shown for selected people, otherwise only the link will show"
},
"DtYelJ": { "DtYelJ": {
"defaultMessage": "Transfer" "defaultMessage": "Transfer"
}, },
@ -668,6 +665,9 @@
"Ss0sWu": { "Ss0sWu": {
"defaultMessage": "Pay Now" "defaultMessage": "Pay Now"
}, },
"TDR5ge": {
"defaultMessage": "Media in notes will automatically be shown for selected people, otherwise only the link will show"
},
"TMfYfY": { "TMfYfY": {
"defaultMessage": "Cashu token" "defaultMessage": "Cashu token"
}, },
@ -782,6 +782,9 @@
"a5UPxh": { "a5UPxh": {
"defaultMessage": "Fund developers and platforms providing NIP-05 verification services" "defaultMessage": "Fund developers and platforms providing NIP-05 verification services"
}, },
"a7TDNm": {
"defaultMessage": "Notes will stream in real time into global and notes tab"
},
"aWpBzj": { "aWpBzj": {
"defaultMessage": "Show more" "defaultMessage": "Show more"
}, },
@ -863,9 +866,6 @@
"eJj8HD": { "eJj8HD": {
"defaultMessage": "Get Verified" "defaultMessage": "Get Verified"
}, },
"eR3YIn": {
"defaultMessage": "Posts"
},
"eSzf2G": { "eSzf2G": {
"defaultMessage": "A single zap of {nIn} sats will allocate {nOut} sats to the zap pool." "defaultMessage": "A single zap of {nIn} sats will allocate {nOut} sats to the zap pool."
}, },
@ -911,9 +911,6 @@
"h8XMJL": { "h8XMJL": {
"defaultMessage": "Badges" "defaultMessage": "Badges"
}, },
"hCUivF": {
"defaultMessage": "Notes will stream in real time into global and posts tab"
},
"hK5ZDk": { "hK5ZDk": {
"defaultMessage": "the world" "defaultMessage": "the world"
}, },

View File

@ -106,7 +106,6 @@
"DcL8P+": "Supporter", "DcL8P+": "Supporter",
"Dh3hbq": "Auto Zap", "Dh3hbq": "Auto Zap",
"DqLx9k": "You must pay {n} sats to access this file.", "DqLx9k": "You must pay {n} sats to access this file.",
"Dt/Zd5": "Media in posts will automatically be shown for selected people, otherwise only the link will show",
"DtYelJ": "Transfer", "DtYelJ": "Transfer",
"E8a4yq": "Follow some popular accounts", "E8a4yq": "Follow some popular accounts",
"ELbg9p": "Data Providers", "ELbg9p": "Data Providers",
@ -218,6 +217,7 @@
"SYQtZ7": "LN Address Proxy", "SYQtZ7": "LN Address Proxy",
"Sjo1P4": "Custom", "Sjo1P4": "Custom",
"Ss0sWu": "Pay Now", "Ss0sWu": "Pay Now",
"TDR5ge": "Media in notes will automatically be shown for selected people, otherwise only the link will show",
"TMfYfY": "Cashu token", "TMfYfY": "Cashu token",
"TpgeGw": "Hex Salt..", "TpgeGw": "Hex Salt..",
"Tpy00S": "People", "Tpy00S": "People",
@ -255,6 +255,7 @@
"ZUZedV": "Lightning Donation:", "ZUZedV": "Lightning Donation:",
"Zr5TMx": "Setup profile", "Zr5TMx": "Setup profile",
"a5UPxh": "Fund developers and platforms providing NIP-05 verification services", "a5UPxh": "Fund developers and platforms providing NIP-05 verification services",
"a7TDNm": "Notes will stream in real time into global and notes tab",
"aWpBzj": "Show more", "aWpBzj": "Show more",
"b12Goz": "Mnemonic", "b12Goz": "Mnemonic",
"b5vAk0": "Your handle will act like a lightning address and will redirect to your chosen LNURL or Lightning address", "b5vAk0": "Your handle will act like a lightning address and will redirect to your chosen LNURL or Lightning address",
@ -281,7 +282,6 @@
"e7qqly": "Mark All Read", "e7qqly": "Mark All Read",
"eHAneD": "Reaction emoji", "eHAneD": "Reaction emoji",
"eJj8HD": "Get Verified", "eJj8HD": "Get Verified",
"eR3YIn": "Posts",
"eSzf2G": "A single zap of {nIn} sats will allocate {nOut} sats to the zap pool.", "eSzf2G": "A single zap of {nIn} sats will allocate {nOut} sats to the zap pool.",
"fOksnD": "Can't vote because LNURL service does not support zaps", "fOksnD": "Can't vote because LNURL service does not support zaps",
"fWZYP5": "Pinned", "fWZYP5": "Pinned",
@ -297,7 +297,6 @@
"gczcC5": "Subscribe", "gczcC5": "Subscribe",
"gjBiyj": "Loading...", "gjBiyj": "Loading...",
"h8XMJL": "Badges", "h8XMJL": "Badges",
"hCUivF": "Notes will stream in real time into global and posts tab",
"hK5ZDk": "the world", "hK5ZDk": "the world",
"hMzcSq": "Messages", "hMzcSq": "Messages",
"hY4lzx": "Supports", "hY4lzx": "Supports",
@ -422,4 +421,4 @@
"zjJZBd": "You're ready!", "zjJZBd": "You're ready!",
"zonsdq": "Failed to load LNURL service", "zonsdq": "Failed to load LNURL service",
"zvCDao": "Automatically show latest notes" "zvCDao": "Automatically show latest notes"
} }