Merge branch 'develop' into enhance-migration

This commit is contained in:
Namekuji 2023-04-19 22:04:10 -04:00 committed by GitHub
commit e99809855e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 14 deletions

View file

@ -53,7 +53,6 @@ describe('After setup instance', () => {
cy.get('[data-cy-signup]').click(); cy.get('[data-cy-signup]').click();
cy.get('[data-cy-signup-rules-continue]').should('be.disabled'); cy.get('[data-cy-signup-rules-continue]').should('be.disabled');
cy.get('[data-cy-signup-rules-notes] [data-cy-folder-header]').click();
cy.get('[data-cy-signup-rules-notes-agree] [data-cy-switch-toggle]').click(); cy.get('[data-cy-signup-rules-notes-agree] [data-cy-switch-toggle]').click();
cy.get('[data-cy-signup-rules-continue]').should('not.be.disabled'); cy.get('[data-cy-signup-rules-continue]').should('not.be.disabled');
cy.get('[data-cy-signup-rules-continue]').click(); cy.get('[data-cy-signup-rules-continue]').click();
@ -78,7 +77,6 @@ describe('After setup instance', () => {
// ユーザー名が重複している場合の挙動確認 // ユーザー名が重複している場合の挙動確認
cy.get('[data-cy-signup]').click(); cy.get('[data-cy-signup]').click();
cy.get('[data-cy-signup-rules-continue]').should('be.disabled'); cy.get('[data-cy-signup-rules-continue]').should('be.disabled');
cy.get('[data-cy-signup-rules-notes] [data-cy-folder-header]').click();
cy.get('[data-cy-signup-rules-notes-agree] [data-cy-switch-toggle]').click(); cy.get('[data-cy-signup-rules-notes-agree] [data-cy-switch-toggle]').click();
cy.get('[data-cy-signup-rules-continue]').should('not.be.disabled'); cy.get('[data-cy-signup-rules-continue]').should('not.be.disabled');
cy.get('[data-cy-signup-rules-continue]').click(); cy.get('[data-cy-signup-rules-continue]').click();

View file

@ -1013,6 +1013,7 @@ horizontal: "横"
position: "位置" position: "位置"
serverRules: "サーバールール" serverRules: "サーバールール"
pleaseConfirmBelowBeforeSignup: "このサーバーに登録する前に、以下を確認してください。" pleaseConfirmBelowBeforeSignup: "このサーバーに登録する前に、以下を確認してください。"
pleaseAgreeAllToContinue: "続けるには、全ての「同意する」にチェックが入っている必要があります。"
continue: "続ける" continue: "続ける"
_serverRules: _serverRules:

View file

@ -44,7 +44,13 @@ async function renderChart() {
const data = []; const data = [];
for (const record of raw) { for (const record of raw) {
let i = 0; data.push({
x: 0,
y: record.createdAt,
v: record.users,
});
let i = 1;
for (const date of Object.keys(record.data).sort((a, b) => new Date(a).getTime() - new Date(b).getTime())) { for (const date of Object.keys(record.data).sort((a, b) => new Date(a).getTime() - new Date(b).getTime())) {
data.push({ data.push({
x: i, x: i,
@ -61,8 +67,14 @@ async function renderChart() {
const color = defaultStore.state.darkMode ? '#b4e900' : '#86b300'; const color = defaultStore.state.darkMode ? '#b4e900' : '#86b300';
// 3 const getYYYYMMDD = (date: Date) => {
const max = raw.map(x => x.users).slice().sort((a, b) => b - a).slice(0, 3).reduce((a, b) => a + b, 0) / 3; const y = date.getFullYear().toString().padStart(2, '0');
const m = (date.getMonth() + 1).toString().padStart(2, '0');
const d = date.getDate().toString().padStart(2, '0');
return `${y}/${m}/${d}`;
};
const max = (createdAt: string) => raw.find(x => x.createdAt === createdAt)!.users;
const marginEachCell = 12; const marginEachCell = 12;
@ -78,7 +90,7 @@ async function renderChart() {
borderRadius: 3, borderRadius: 3,
backgroundColor(c) { backgroundColor(c) {
const value = c.dataset.data[c.dataIndex].v; const value = c.dataset.data[c.dataIndex].v;
const a = value / max; const a = value / max(c.dataset.data[c.dataIndex].y);
return alpha(color, a); return alpha(color, a);
}, },
fill: true, fill: true,
@ -115,7 +127,7 @@ async function renderChart() {
maxRotation: 0, maxRotation: 0,
autoSkipPadding: 0, autoSkipPadding: 0,
autoSkip: false, autoSkip: false,
callback: (value, index, values) => value + 1, callback: (value, index, values) => value,
}, },
}, },
y: { y: {
@ -150,11 +162,11 @@ async function renderChart() {
callbacks: { callbacks: {
title(context) { title(context) {
const v = context[0].dataset.data[context[0].dataIndex]; const v = context[0].dataset.data[context[0].dataIndex];
return v.d; return getYYYYMMDD(new Date(new Date(v.y).getTime() + (v.x * 86400000)));
}, },
label(context) { label(context) {
const v = context.dataset.data[context.dataIndex]; const v = context.dataset.data[context.dataIndex];
return ['Active: ' + v.v]; return [`Active: ${v.v} (${Math.round((v.v / max(v.y)) * 100)}%)`];
}, },
}, },
//mode: 'index', //mode: 'index',

View file

@ -18,7 +18,7 @@
<MkSwitch v-model="agreeServerRules" style="margin-top: 16px;">{{ i18n.ts.agree }}</MkSwitch> <MkSwitch v-model="agreeServerRules" style="margin-top: 16px;">{{ i18n.ts.agree }}</MkSwitch>
</MkFolder> </MkFolder>
<MkFolder v-if="availableTos"> <MkFolder v-if="availableTos" :default-open="true">
<template #label>{{ i18n.ts.termsOfService }}</template> <template #label>{{ i18n.ts.termsOfService }}</template>
<template #suffix><i v-if="agreeTos" class="ti ti-check" style="color: var(--success)"></i></template> <template #suffix><i v-if="agreeTos" class="ti ti-check" style="color: var(--success)"></i></template>
@ -27,7 +27,7 @@
<MkSwitch v-model="agreeTos" style="margin-top: 16px;">{{ i18n.ts.agree }}</MkSwitch> <MkSwitch v-model="agreeTos" style="margin-top: 16px;">{{ i18n.ts.agree }}</MkSwitch>
</MkFolder> </MkFolder>
<MkFolder data-cy-signup-rules-notes> <MkFolder :default-open="true">
<template #label>{{ i18n.ts.basicNotesBeforeCreateAccount }}</template> <template #label>{{ i18n.ts.basicNotesBeforeCreateAccount }}</template>
<template #suffix><i v-if="agreeNote" class="ti ti-check" style="color: var(--success)"></i></template> <template #suffix><i v-if="agreeNote" class="ti ti-check" style="color: var(--success)"></i></template>
@ -36,7 +36,12 @@
<MkSwitch v-model="agreeNote" style="margin-top: 16px;" data-cy-signup-rules-notes-agree>{{ i18n.ts.agree }}</MkSwitch> <MkSwitch v-model="agreeNote" style="margin-top: 16px;" data-cy-signup-rules-notes-agree>{{ i18n.ts.agree }}</MkSwitch>
</MkFolder> </MkFolder>
<MkButton primary rounded gradate style="margin: 0 auto;" :disabled="!agreed" data-cy-signup-rules-continue @click="emit('accept')">{{ i18n.ts.continue }} <i class="ti ti-arrow-right"></i></MkButton> <div v-if="!agreed" style="text-align: center;">{{ i18n.ts.pleaseAgreeAllToContinue }}</div>
<div class="_buttonsCenter">
<MkButton inline rounded @click="emit('cancel')">{{ i18n.ts.cancel }}</MkButton>
<MkButton inline primary rounded gradate :disabled="!agreed" data-cy-signup-rules-continue @click="emit('done')">{{ i18n.ts.continue }} <i class="ti ti-arrow-right"></i></MkButton>
</div>
</div> </div>
</MkSpacer> </MkSpacer>
</div> </div>
@ -62,7 +67,8 @@ const agreed = computed(() => {
}); });
const emit = defineEmits<{ const emit = defineEmits<{
(ev: 'accept'): void; (ev: 'cancel'): void;
(ev: 'done'): void;
}>(); }>();
</script> </script>

View file

@ -17,7 +17,7 @@
:leave-to-class="$style.transition_x_leaveTo" :leave-to-class="$style.transition_x_leaveTo"
> >
<template v-if="!isAcceptedServerRule"> <template v-if="!isAcceptedServerRule">
<XServerRules @accept="isAcceptedServerRule = true"/> <XServerRules @done="isAcceptedServerRule = true" @cancel="dialog.close()"/>
</template> </template>
<template v-else> <template v-else>
<XSignup :auto-set="autoSet" @signup="onSignup" @signup-email-pending="onSignupEmailPending"/> <XSignup :auto-set="autoSet" @signup="onSignup" @signup-email-pending="onSignupEmailPending"/>