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

~web #722

Merged
merged 5 commits into from
Nov 13, 2023
Merged

~web #722

Show file tree
Hide file tree
Changes from all commits
Commits
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
64 changes: 64 additions & 0 deletions src/core/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
module.exports = {
extends: ['plugin:react/recommended', 'plugin:react-hooks/recommended'],
plugins: ['react', 'react-native'],
rules: {
'react/jsx-boolean-value': ['error', 'never'],
'react/jsx-closing-bracket-location': [
'error',
{
nonEmpty: 'after-props',
selfClosing: 'after-props',
},
],
'react/jsx-closing-tag-location': [
'error',
{
nonEmpty: 'after-props',
selfClosing: 'after-props',
},
],
'react/jsx-curly-newline': [
'error',
{
multiline: 'consistent',
singleline: 'consistent',
},
],
'react/jsx-curly-spacing': ['error', { when: 'always' }],
'react/jsx-first-prop-new-line': ['error', 'multiline-multiprop'],
'react/jsx-fragments': ['error', 'element'],
'react/jsx-indent': ['error', 2],
'react/jsx-indent-props': ['error', 2],
'react/jsx-max-props-per-line': [
'error',
{
maximum: 1,
when: 'multiline',
},
],
'react/jsx-one-expression-per-line': ['error', { allow: 'single-child' }],
'react/jsx-props-no-multi-spaces': ['error'],
'react/jsx-tag-spacing': [
'error',
{
afterOpening: 'never',
beforeClosing: 'never',
beforeSelfClosing: 'always',
closingSlash: 'never',
},
],
'react/jsx-wrap-multilines': [
'error',
{
arrow: 'parens-new-line',
assignment: 'parens-new-line',
condition: 'parens-new-line',
declaration: 'parens-new-line',
logical: 'parens-new-line',
prop: 'parens-new-line',
return: 'parens-new-line',
},
],
},
settings: { react: { version: '18.2.0' } },
};
5 changes: 0 additions & 5 deletions src/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
"name": "readless-scripts",
"version": "0.0.1",
"type": "module",
"export": "dist/index.cjs",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"engines": {
"node": ">=18.0.0"
},
Expand Down
18 changes: 13 additions & 5 deletions src/core/src/client/contexts/storage/StorageContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ export function StorageContextProvider({ children }: React.PropsWithChildren) {
}, [withHeaders]);

const updateRemotePref = React.useCallback(async <K extends keyof Storage>(key: K, newState?: Storage[K]) => {
if (!storage.userData?.valid) {
return;
}
if (!SYNCABLE_SETTINGS.includes(key)) {
return;
}
Expand All @@ -196,7 +199,7 @@ export function StorageContextProvider({ children }: React.PropsWithChildren) {
} catch (e) {
console.error(e);
}
}, [api]);
}, [api, storage]);

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const handleBadRequest = React.useCallback(async (e?: any) => {
Expand All @@ -215,6 +218,7 @@ export function StorageContextProvider({ children }: React.PropsWithChildren) {
isFetchingProfile: false,
isSyncingWithRemote: false,
}));
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const loadBookmarks = React.useCallback(async (ids: number[]) => {
Expand All @@ -237,6 +241,7 @@ export function StorageContextProvider({ children }: React.PropsWithChildren) {
hasSyncedBookmarks: true,
isSyncingBookmarks: false,
}));
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [api]);

const syncWithRemotePrefs = React.useCallback(async (prefs?: ProfileResponse) => {
Expand Down Expand Up @@ -299,6 +304,7 @@ export function StorageContextProvider({ children }: React.PropsWithChildren) {
hasSyncedWithRemote: true,
isSyncingWithRemote: false,
}));
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [syncState.hasLoadedLocalState, storage.userData?.valid, handleBadRequest, api, loadBookmarks]);

// Load preferences on mount
Expand Down Expand Up @@ -378,7 +384,13 @@ export function StorageContextProvider({ children }: React.PropsWithChildren) {
if (storage.lastRemoteSync && !storage.userData?.valid) {
resetStorage();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [storage.lastRemoteSync, storage.userData]);

React.useEffect(() => {
load();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

// push notification functions

Expand Down Expand Up @@ -605,10 +617,6 @@ export function StorageContextProvider({ children }: React.PropsWithChildren) {

const isExcludingCategory = React.useCallback((category: PublicCategoryAttributes) => category.name in ({ ...storage.excludedCategories }), [storage.excludedCategories]);

React.useEffect(() => {
load();
}, []);

return (
<StorageContext.Provider
value={ {
Expand Down
2 changes: 1 addition & 1 deletion src/core/src/client/contexts/storage/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ export const SYNCABLE_SETTINGS: (keyof Storage)[] = [
'favoritedCategories',
'excludedCategories',
'userStats',
] as const;
];

export type SyncableSetting = typeof SYNCABLE_SETTINGS[number];

Expand Down
7 changes: 4 additions & 3 deletions src/core/src/client/locales/ar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export const arStrings: typeof enStrings = {
font: 'الخط',
fontSize: 'حجم الخط',
forgotPassword: 'هل نسيت كلمة السر؟',
formatOnShortPress: 'التنسيق بالضغط القصير',
free: 'حر',
fromNewsHeadlines: 'من عناوين الأخبار',
fullArticle: 'المادة كاملة',
Expand Down Expand Up @@ -117,6 +118,7 @@ export const arStrings: typeof enStrings = {
inaccurate: 'هذا غير دقيق',
incorrectSentiment: 'هذا الملخص لديه المشاعر الخاطئة',
information: 'فيما يلي بعض الملخصات اليومية إذا فاتتك الأخبار لأنك كنت تلمس العشب',
informationWithoutTheNoise: 'المعلومات دون ضجيج',
instagram: 'انستغرام',
instagramStories: 'قصص انستغرام',
insteadOfRemoving: '** بدلاً من إزالة المشاعر تمامًا ** ، تهدف "قراءة أقل" إلى ** قياس المشاعر ** بمرور الوقت.',
Expand Down Expand Up @@ -211,11 +213,10 @@ export const arStrings: typeof enStrings = {
share: 'يشارك',
shareArticles: 'هل تعلم أنه يمكنك مشاركة مقال مثير للاهتمام مباشرة من خلال ** الضغط مع الاستمرار على ** على البطاقة نفسها؟',
shareAsImage: 'شارك كصورة',
shareAsLink: 'شارك كرابط',
shareOriginalLink: 'مشاركة الرابط الأصلي',
shortPress: 'ضغطة قصيرة لعرض خيارات القائمة',
shortSummaries: 'ملخصات قصيرة تحت العناوين',
shortPressToQuickView: 'اضغط لفترة قصيرة لعرض ملخص سريع',
shortSummariesInsteadOfTitles: 'ملخصات قصيرة بدلاً من العناوين',
shortSummariesUnderTitles: 'ملخصات قصيرة تحت العناوين',
shortSummary: 'ملخص قصير',
showOriginalText: 'إظهار النص الأصلي',
showSourceLinks: 'إظهار ارتباطات المصدر',
Expand Down
7 changes: 4 additions & 3 deletions src/core/src/client/locales/ca.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export const caStrings: typeof enStrings = {
font: 'Font',
fontSize: 'Mida de la font',
forgotPassword: 'Has oblidat la contrasenya?',
formatOnShortPress: 'Format amb premsa curta',
free: 'Gratuït',
fromNewsHeadlines: 'dels titulars de les notícies',
fullArticle: 'Article complet',
Expand Down Expand Up @@ -117,6 +118,7 @@ export const caStrings: typeof enStrings = {
inaccurate: 'Això és inexacte',
incorrectSentiment: 'Aquest resum té el sentiment equivocat',
information: 'Aquí teniu alguns resums diaris si us vau perdre la notícia perquè tocava gespa',
informationWithoutTheNoise: 'Informació sense soroll',
instagram: 'Instagram',
instagramStories: 'Històries d\'Instagram',
insteadOfRemoving: '**En lloc d\'eliminar el sentiment del tot**, Llegir menys té com a objectiu **mesurar el sentiment** al llarg del temps.',
Expand Down Expand Up @@ -211,11 +213,10 @@ export const caStrings: typeof enStrings = {
share: 'Compartir',
shareArticles: 'Sabíeu que podeu compartir directament un article interessant **prem i manteniu premuda** la targeta?',
shareAsImage: 'Comparteix com a imatge',
shareAsLink: 'Comparteix com a enllaç',
shareOriginalLink: 'Comparteix l\'enllaç original',
shortPress: 'Premeu breument per veure les opcions del menú',
shortSummaries: 'Breus resums sota títols',
shortPressToQuickView: 'Premeu breument per visualitzar ràpidament un resum',
shortSummariesInsteadOfTitles: 'Resums breus en comptes de títols',
shortSummariesUnderTitles: 'Breus resums sota títols',
shortSummary: 'Breu resum',
showOriginalText: 'Mostra el text original',
showSourceLinks: 'Mostra els enllaços d\'origen',
Expand Down
7 changes: 4 additions & 3 deletions src/core/src/client/locales/cs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export const csStrings: typeof enStrings = {
font: 'Písmo',
fontSize: 'Velikost písma',
forgotPassword: 'Zapomenuté heslo?',
formatOnShortPress: 'Formátování krátkým stisknutím',
free: 'Volný, uvolnit',
fromNewsHeadlines: 'z titulků zpráv',
fullArticle: 'Celý článek',
Expand Down Expand Up @@ -117,6 +118,7 @@ export const csStrings: typeof enStrings = {
inaccurate: 'To je nepřesné',
incorrectSentiment: 'Toto shrnutí má špatný sentiment',
information: 'Zde je několik denních rekapitulací, pokud jste zmeškali zprávy, protože jste se dotýkali trávy',
informationWithoutTheNoise: 'Informace bez hluku',
instagram: 'Instagram',
instagramStories: 'Instagramové příběhy',
insteadOfRemoving: '**Namísto úplného odstranění sentimentu** se Read Less snaží **měřit sentiment** v průběhu času.',
Expand Down Expand Up @@ -211,11 +213,10 @@ export const csStrings: typeof enStrings = {
share: 'Podíl',
shareArticles: 'Věděli jste, že můžete přímo sdílet zajímavý článek **stisknutím a podržením** na samotné kartě?',
shareAsImage: 'Sdílet jako obrázek',
shareAsLink: 'Sdílet jako odkaz',
shareOriginalLink: 'Sdílejte původní odkaz',
shortPress: 'Krátkým stisknutím zobrazíte možnosti nabídky',
shortSummaries: 'Krátké shrnutí pod názvy',
shortPressToQuickView: 'Krátkým stisknutím rychle zobrazíte souhrn',
shortSummariesInsteadOfTitles: 'Krátká shrnutí místo názvů',
shortSummariesUnderTitles: 'Krátké shrnutí pod názvy',
shortSummary: 'Krátké shrnutí',
showOriginalText: 'Zobrazit původní text',
showSourceLinks: 'Zobrazit odkazy na zdroje',
Expand Down
7 changes: 4 additions & 3 deletions src/core/src/client/locales/da.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export const daStrings: typeof enStrings = {
font: 'Skrifttype',
fontSize: 'Skriftstørrelse',
forgotPassword: 'Glemt kodeord?',
formatOnShortPress: 'Formatér ved kort tryk',
free: 'Gratis',
fromNewsHeadlines: 'fra nyhedsoverskrifter',
fullArticle: 'Fuld artikel',
Expand Down Expand Up @@ -117,6 +118,7 @@ export const daStrings: typeof enStrings = {
inaccurate: 'Dette er unøjagtigt',
incorrectSentiment: 'Dette resumé har den forkerte holdning',
information: 'Her er nogle daglige opsummeringer, hvis du gik glip af nyhederne, fordi du rørte græs',
informationWithoutTheNoise: 'Information uden støj',
instagram: 'Instagram',
instagramStories: 'Instagram-historier',
insteadOfRemoving: '**I stedet for at fjerne følelser helt**, sigter Read Less efter at **måle følelser** over tid.',
Expand Down Expand Up @@ -211,11 +213,10 @@ export const daStrings: typeof enStrings = {
share: 'Del',
shareArticles: 'Vidste du, at du direkte kan dele en interessant artikel ved at **trykke og holde** på selve kortet?',
shareAsImage: 'Del som billede',
shareAsLink: 'Del som link',
shareOriginalLink: 'Del originalt link',
shortPress: 'Kort tryk for at se menuindstillinger',
shortSummaries: 'Korte resuméer under titler',
shortPressToQuickView: 'Kort tryk for hurtigt at se en oversigt',
shortSummariesInsteadOfTitles: 'Korte resuméer i stedet for titler',
shortSummariesUnderTitles: 'Korte resuméer under titler',
shortSummary: 'Kort Resumé',
showOriginalText: 'Vis original tekst',
showSourceLinks: 'Vis kildelinks',
Expand Down
7 changes: 4 additions & 3 deletions src/core/src/client/locales/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export const deStrings: typeof enStrings = {
font: 'Schriftart',
fontSize: 'Schriftgröße',
forgotPassword: 'Passwort vergessen?',
formatOnShortPress: 'Formatieren durch kurzes Drücken',
free: 'Frei',
fromNewsHeadlines: 'aus Schlagzeilen',
fullArticle: 'Ganzer Artikel',
Expand Down Expand Up @@ -117,6 +118,7 @@ export const deStrings: typeof enStrings = {
inaccurate: 'Das ist ungenau',
incorrectSentiment: 'Diese Zusammenfassung hat die falsche Stimmung',
information: 'Hier sind einige tägliche Rückblicke für den Fall, dass Sie die Nachrichten verpasst haben, weil Sie Gras berührt haben',
informationWithoutTheNoise: 'Informationen ohne Lärm',
instagram: 'Instagram',
instagramStories: 'Instagram-Geschichten',
insteadOfRemoving: '**Anstatt die Stimmung ganz zu entfernen**, zielt Read Less darauf ab, die Stimmung über einen längeren Zeitraum zu messen.',
Expand Down Expand Up @@ -211,11 +213,10 @@ export const deStrings: typeof enStrings = {
share: 'Aktie',
shareArticles: 'Wussten Sie, dass Sie einen interessanten Artikel direkt teilen können, indem Sie die Karte selbst **gedrückt halten**?',
shareAsImage: 'Als Bild teilen',
shareAsLink: 'Als Link teilen',
shareOriginalLink: 'Originallink teilen',
shortPress: 'Kurz drücken, um Menüoptionen anzuzeigen',
shortSummaries: 'Kurze Zusammenfassungen unter Titeln',
shortPressToQuickView: 'Kurz drücken, um schnell eine Zusammenfassung anzuzeigen',
shortSummariesInsteadOfTitles: 'Kurze Zusammenfassungen statt Titel',
shortSummariesUnderTitles: 'Kurze Zusammenfassungen unter Titeln',
shortSummary: 'Kurze Zusammenfassung',
showOriginalText: 'Originaltext anzeigen',
showSourceLinks: 'Quelllinks anzeigen',
Expand Down
7 changes: 4 additions & 3 deletions src/core/src/client/locales/el.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export const elStrings: typeof enStrings = {
font: 'Γραμματοσειρά',
fontSize: 'Μέγεθος γραμματοσειράς',
forgotPassword: 'Ξεχάσατε τον κωδικό;',
formatOnShortPress: 'Μορφοποίηση με σύντομο πάτημα',
free: 'Ελεύθερος',
fromNewsHeadlines: 'από πρωτοσέλιδα ειδήσεων',
fullArticle: 'Πλήρες άρθρο',
Expand Down Expand Up @@ -117,6 +118,7 @@ export const elStrings: typeof enStrings = {
inaccurate: 'Αυτό είναι ανακριβές',
incorrectSentiment: 'Αυτή η περίληψη έχει λάθος αίσθηση',
information: 'Ακολουθούν μερικές ημερήσιες ανακεφαλαιώσεις εάν χάσατε τα νέα επειδή αγγίξατε γρασίδι',
informationWithoutTheNoise: 'Πληροφορίες χωρίς θόρυβο',
instagram: 'Ίνσταγκραμ',
instagramStories: 'Ιστορίες Instagram',
insteadOfRemoving: '**Αντί να αφαιρέσει εντελώς το συναίσθημα**, το Read Less στοχεύει να **μετρήσει το συναίσθημα** με την πάροδο του χρόνου.',
Expand Down Expand Up @@ -211,11 +213,10 @@ export const elStrings: typeof enStrings = {
share: 'Μερίδιο',
shareArticles: 'Γνωρίζατε ότι μπορείτε να μοιραστείτε απευθείας ένα ενδιαφέρον άρθρο **πατώντας παρατεταμένα** στην ίδια την κάρτα;',
shareAsImage: 'Κοινή χρήση ως εικόνα',
shareAsLink: 'Κοινή χρήση ως σύνδεσμος',
shareOriginalLink: 'Μοιραστείτε τον αρχικό σύνδεσμο',
shortPress: 'Πατήστε σύντομα για να δείτε τις επιλογές μενού',
shortSummaries: 'Σύντομες περιλήψεις κάτω από τίτλους',
shortPressToQuickView: 'Πατήστε σύντομα για γρήγορη προβολή μιας περίληψης',
shortSummariesInsteadOfTitles: 'Σύντομες περιλήψεις αντί για τίτλους',
shortSummariesUnderTitles: 'Σύντομες περιλήψεις κάτω από τίτλους',
shortSummary: 'Σύντομη περίληψη',
showOriginalText: 'Εμφάνιση πρωτότυπου κειμένου',
showSourceLinks: 'Εμφάνιση συνδέσμων πηγών',
Expand Down
7 changes: 4 additions & 3 deletions src/core/src/client/locales/en-last.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export const enStrings = {
font: 'Font',
fontSize: 'Font Size',
forgotPassword: 'Forgot Password?',
formatOnShortPress: 'Format on short press',
free: 'Free',
fromNewsHeadlines: 'from news headlines',
fullArticle: 'Full Article',
Expand Down Expand Up @@ -115,6 +116,7 @@ export const enStrings = {
inaccurate: 'This is inaccurate',
incorrectSentiment: 'This summary has the wrong sentiment',
information: 'Here are some daily recaps if you missed the news because you were touching grass',
informationWithoutTheNoise: 'Information without the noise',
instagram: 'Instagram',
instagramStories: 'Instagram Stories',
insteadOfRemoving: '**Instead of removing sentiment altogether**, Read Less aims to **measure sentiment** over time.',
Expand Down Expand Up @@ -209,11 +211,10 @@ export const enStrings = {
share: 'Share',
shareArticles: 'Did you know you can directly share an interesting article by **pressing and holding** on the card itself?',
shareAsImage: 'Share as Image',
shareAsLink: 'Share',
shareOriginalLink: 'Share Original Link',
shortPress: 'Short press to quick view a summary',
shortSummaries: 'Short summaries under titles',
shortPressToQuickView: 'Short press to quick view a summary',
shortSummariesInsteadOfTitles: 'Short summaries instead of titles',
shortSummariesUnderTitles: 'Short summaries under titles',
shortSummary: 'Short Summary',
showOriginalText: 'Show Original Text',
showSourceLinks: 'Show Source Links',
Expand Down
11 changes: 6 additions & 5 deletions src/core/src/client/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ export const enStrings = {
font: 'Font',
fontSize: 'Font Size',
forgotPassword: 'Forgot Password?',
formatOnShortPress: 'Format on short press',
free: 'Free',
fromNewsHeadlines: 'from news headlines',
fullArticle: 'Full Article',
fullArticleInfo: 'Selecting this option, will automatically open the original article for a summary in the in-app browser when you tap on it.',
fullArticle: 'Full Article',
fullArticleInfo: 'Selecting this option, will automatically open the original article for a summary in the in-app browser when you tap on it.',
general: 'General',
goToBrowse: 'Go to Browse',
granularControl: 'with infinite **granular control** \nover your news experience',
Expand Down Expand Up @@ -114,6 +115,7 @@ export const enStrings = {
inaccurate: 'This is inaccurate',
incorrectSentiment: 'This summary has the wrong sentiment',
information: 'Here are some daily recaps if you missed the news because you were touching grass',
informationWithoutTheNoise: 'Information without the noise',
instagram: 'Instagram',
instagramStories: 'Instagram Stories',
insteadOfRemoving: '**Instead of removing sentiment altogether**, Read Less aims to **measure sentiment** over time.',
Expand Down Expand Up @@ -208,11 +210,10 @@ export const enStrings = {
share: 'Share',
shareArticles: 'Did you know you can directly share an interesting article by **pressing and holding** on the card itself?',
shareAsImage: 'Share as Image',
shareAsLink: 'Share',
shareOriginalLink: 'Share Original Link',
shortPress: 'Short press to quick view a summary',
shortSummaries: 'Short summaries under titles',
shortPressToQuickView: 'Short press to quick view a summary',
shortSummariesInsteadOfTitles: 'Short summaries instead of titles',
shortSummariesUnderTitles: 'Short summaries under titles',
shortSummary: 'Short Summary',
showOriginalText: 'Show Original Text',
showSourceLinks: 'Show Source Links',
Expand Down
Loading