1
0
Fork 0
mirror of https://github.com/anyproto/anytype-ts.git synced 2025-06-08 05:57:02 +09:00

Merge branch 'main' of github.com:anyproto/anytype-ts into feature/primitives

This commit is contained in:
Andrew Simachev 2025-02-20 13:44:30 +01:00
commit 9bc1b2950d
No known key found for this signature in database
GPG key ID: 1DFE44B21443F0EF
9 changed files with 85 additions and 23 deletions

View file

@ -257,7 +257,7 @@
$.ajax({
url: html,
dataType: 'text',
timeout: 1000,
timeout: 3000,
success: (data) => {
root.html(data);

View file

@ -1,12 +1,29 @@
{
"enabledLangs": [
"be-BY", "cs-CZ", "da-DK",
"de-DE", "en-US", "es-ES",
"fr-FR", "hi-IN", "id-ID",
"it-IT", "lt-LT", "ja-JP",
"ko-KR", "nl-NL", "no-NO",
"pl-PL", "pt-BR", "ro-RO",
"ru-RU", "tr-TR", "uk-UA",
"vi-VN", "zh-CN", "zh-TW"
"be-BY",
"cs-CZ",
"da-DK",
"de-DE",
"en-US",
"es-ES",
"fa-IR",
"fr-FR",
"hi-IN",
"id-ID",
"it-IT",
"lt-LT",
"ja-JP",
"ko-KR",
"nl-NL",
"no-NO",
"pl-PL",
"pt-BR",
"ro-RO",
"ru-RU",
"tr-TR",
"uk-UA",
"vi-VN",
"zh-CN",
"zh-TW"
]
}

View file

@ -7,6 +7,7 @@ export default {
'de-DE',
'en-US',
'es-ES',
'fa-IR',
'fr-FR',
'hi-IN',
'id-ID',
@ -91,6 +92,7 @@ export default {
'de-DE': 'de-DE',
'en-US': 'en',
'es-ES': 'es',
'fa-IR': 'fa',
'fr-FR': 'fr-FR',
'hi-IN': 'hi',
'id-ID': 'id',

View file

@ -779,6 +779,7 @@
"popupSettingsPersonalSidebar": "Automatically show and hide sidebar",
"popupSettingsPersonalSidebarMode": "Sidebar mode",
"popupSettingsPersonalRelativeDates": "Use relative dates",
"popupSettingsPersonalFirstDay": "Week starts on",
"popupSettingsPersonalDateFormat": "Date format",
"popupSettingsPersonalSectionLanguage": "Language & Spelling",
"popupSettingsPersonalSectionEditor": "Editor Personalisation",

View file

@ -37,14 +37,10 @@ const MenuCalendar = observer(class MenuCalendar extends React.Component<I.Menu,
const now = U.Date.now();
const tomorrow = now + 86400;
const dayToday = U.Date.today();
const days = [];
const days = U.Date.getWeekDays();
const months = [];
const years = [];
for (let i = 1; i <= 7; ++i) {
days.push({ id: i, name: translate('day' + i) });
};
for (let i = 1; i <= 12; ++i) {
months.push({ id: i, name: translate('month' + i) });
};

View file

@ -5,10 +5,14 @@ import { observer } from 'mobx-react';
const PageMainSettingsLanguage = observer(forwardRef<{}, I.PageSettingsComponent>((props, ref) => {
const { config, interfaceLang, showRelativeDates, dateFormat, timeFormat, } = S.Common;
const { config, interfaceLang, showRelativeDates, dateFormat, timeFormat, firstDay } = S.Common;
const { languages } = config;
const interfaceLanguages = U.Menu.getInterfaceLanguages();
const spellingRef = useRef(null);
const firstDayOptions = [
{ id: 1, name: translate('day1') },
{ id: 7, name: translate('day7') },
];
const getSpellingLanguages = () => {
const { languages } = config;
@ -116,6 +120,21 @@ const PageMainSettingsLanguage = observer(forwardRef<{}, I.PageSettingsComponent
/>
</div>
<div className="item">
<Label text={translate('popupSettingsPersonalFirstDay')} />
<Select
id="firstDay"
value={String(firstDay)}
options={firstDayOptions}
onChange={v => {
console.log(v);
S.Common.firstDaySet(v);
}}
arrowClassName="black"
menuParam={{ horizontal: I.MenuDirection.Right }}
/>
</div>
</div>
</>
);

View file

@ -649,7 +649,6 @@ class Action {
return;
};
const { space } = S.Common;
const isOwner = U.Space.isMyOwner(id);
const name = U.Common.shorten(deleted.name, 32);
const suffix = isOwner ? 'Delete' : 'Leave';

View file

@ -1,4 +1,4 @@
import { I, U, J, translate } from 'Lib';
import { I, U, J, S, translate } from 'Lib';
class UtilDate {
@ -161,7 +161,8 @@ class UtilDate {
return d.getDay();
},
N: () => {
return (f.w() + 6) % 7;
const w = f.w();
return w == 0 ? 7 : w;
},
l: () => {
return translate(`day${f.N() + 1}`);
@ -329,6 +330,7 @@ class UtilDate {
};
getCalendarMonth (value: number) {
const { firstDay } = S.Common;
const { m, y } = this.getCalendarDateParam(value);
const md = {...J.Constant.monthDays};
@ -337,8 +339,8 @@ class UtilDate {
md[2] = 29;
};
const wdf = Number(this.date('N', this.timestamp(y, m, 1)));
const wdl = Number(this.date('N', this.timestamp(y, m, md[m])));
let wdf = Number(this.date('N', this.timestamp(y, m, 1)));
let wdl = Number(this.date('N', this.timestamp(y, m, md[m])));
let pm = m - 1;
let nm = m + 1;
let py = y;
@ -354,6 +356,9 @@ class UtilDate {
ny = y + 1;
};
wdf = (wdf - firstDay + 7) % 7;
wdl = (wdl - firstDay + 7) % 7;
const days = [];
for (let i = 1; i <= wdf; ++i) {
days.push({ d: md[pm] - (wdf - i), m: pm, y: py });
@ -361,8 +366,7 @@ class UtilDate {
for (let i = 1; i <= md[m]; ++i) {
days.push({ y: y, m: m, d: i });
};
for (let i = 1; i < 7 - wdl; ++i) {
for (let i = 1; i <= (6 - wdl); ++i) {
days.push({ d: i, m: nm, y: ny });
};
@ -390,10 +394,17 @@ class UtilDate {
};
getWeekDays (): { id: number, name: string }[] {
const { firstDay } = S.Common;
const ret = [];
for (let i = 1; i <= 7; ++i) {
for (let i = firstDay; i <= 7; ++i) {
ret.push({ id: i, name: translate(`day${i}`) });
};
for (let i = 1; i < firstDay; ++i) {
ret.push({ id: i, name: translate(`day${i}`) });
};
return ret;
};

View file

@ -45,6 +45,7 @@ class CommonStore {
public showSidebarRightValue = { full: false, popup: false };
public hideSidebarValue = null;
public pinValue = null;
public firstDayValue = null;
public gallery = {
categories: [],
list: [],
@ -108,6 +109,7 @@ class CommonStore {
dateFormatValue: observable,
timeFormatValue: observable,
pinValue: observable,
firstDayValue: observable,
config: computed,
preview: computed,
toast: computed,
@ -123,6 +125,7 @@ class CommonStore {
dateFormat: computed,
timeFormat: computed,
pin: computed,
firstDay: computed,
gatewaySet: action,
filterSetFrom: action,
filterSetText: action,
@ -143,6 +146,7 @@ class CommonStore {
showSidebarRightSet: action,
showRelativeDatesSet: action,
pinSet: action,
firstDaySet: action,
});
intercept(this.configObj as any, change => U.Common.intercept(this.configObj, change));
@ -315,6 +319,14 @@ class CommonStore {
return ret;
};
get firstDay (): number {
if (this.firstDayValue === null) {
this.firstDayValue = Storage.get('firstDay');
};
return Number(this.firstDayValue) || 1;
};
gatewaySet (v: string) {
this.gatewayUrl = v;
};
@ -537,6 +549,11 @@ class CommonStore {
console.log('[Online status]:', v);
};
firstDaySet (v: number) {
this.firstDayValue = Number(v) || 1;
Storage.set('firstDay', this.firstDayValue);
};
configSet (config: any, force: boolean) {
const html = $('html');