0
0
Fork 0
This commit is contained in:
xeltica 2021-09-07 20:50:09 +09:00
parent d94f2c91fb
commit 17a12d127c
5 changed files with 78 additions and 50 deletions

View file

@ -14,7 +14,7 @@ export const SessionDataPage: React.VFC = () => {
<Skeleton width="100%" height="160px" />
</div>
) : (
<>
<div className="fade">
{session.data && (
<section>
<p>
@ -39,7 +39,7 @@ export const SessionDataPage: React.VFC = () => {
{score.data && (
<section>
<h2></h2>
<table className="table fluid">
<table className="table fluid shadow-2" style={{border: 'none'}}>
<thead>
<tr>
<th></th>
@ -67,6 +67,6 @@ export const SessionDataPage: React.VFC = () => {
</table>
</section>
)}
</>
</div>
);
};

View file

@ -1,4 +1,4 @@
import React, { useEffect, useReducer } from 'react';
import React, { useEffect, useMemo, useReducer } from 'react';
import { AlertMode } from '../../common/types/alert-mode';
import { IUser } from '../../common/types/user';
import { Visibility } from '../../common/types/visibility';
@ -42,52 +42,63 @@ export const SettingPage: React.VFC = () => {
}
}, [session.data]);
const saveButton = useMemo(() => (
<button className="btn primary" style={{alignSelf: 'flex-end'}}>
</button>
), []);
return session.isLoading || !data ? (
<div className="skeleton" style={{width: '100%', height: '128px'}}></div>
) : (
<div className="vstack">
<div>
<label htmlFor="alertMode" className="input-field"></label>
<select name="alertMode" className="input-field" value={draft.alertMode} onChange={(e) => {
dispatchDraft({ alertMode: e.target.value as AlertMode });
}}>
<option value="note">稿</option>
<option value="notification">Misskeyに通知()</option>
<option value="nothing"></option>
</select>
{draft.alertMode === 'notification' && (
<div className="alert bg-danger mt-2">
<i className="icon bi bi-exclamation-circle"></i>
Misskey Misskeyでは動作しません
<div className="vstack fade">
<div className="card">
<div className="body vstack">
<h1></h1>
<div>
<select name="alertMode" className="input-field" value={draft.alertMode} onChange={(e) => {
dispatchDraft({ alertMode: e.target.value as AlertMode });
}}>
<option value="note">稿</option>
<option value="notification">Misskeyに通知()</option>
<option value="nothing"></option>
</select>
{draft.alertMode === 'notification' && (
<div className="alert bg-danger mt-2">
<i className="icon bi bi-exclamation-circle"></i>
Misskey Misskeyでは動作しません
</div>
)}
</div>
)}
</div>
{ draft.alertMode === 'note' && (
<div>
<label htmlFor="visibility" className="input-field"></label>
<select name="visibility" className="input-field" value={draft.visibility} onChange={(e) => {
dispatchDraft({ visibility: e.target.value as Visibility });
}}>
<option value="public"></option>
<option value="home"></option>
<option value="followers"></option>
</select>
<label className="input-switch mt-2">
<input type="checkbox" />
<div className="switch"></div>
<span></span>
</label>
{ draft.alertMode === 'note' && (
<div>
<label htmlFor="visibility" className="input-field"></label>
<select name="visibility" className="input-field" value={draft.visibility} onChange={(e) => {
dispatchDraft({ visibility: e.target.value as Visibility });
}}>
<option value="public"></option>
<option value="home"></option>
<option value="followers"></option>
</select>
<label className="input-switch mt-2">
<input type="checkbox" />
<div className="switch"></div>
<span></span>
</label>
</div>
)}
{saveButton}
</div>
</div>
<div className="card">
<div className="body vstack">
<h1></h1>
<textarea className="input-field" value={draft.template ?? defaultTemplate} style={{height: 228}} onChange={(e) => {
dispatchDraft({ template: e.target.value });
}} />
{saveButton}
</div>
)}
<div>
<label htmlFor="template" className="input-field"></label>
<textarea className="input-field" value={draft.template ?? defaultTemplate} style={{height: 256}} onChange={(e) => {
dispatchDraft({ template: e.target.value });
}} />
</div>
<button className="btn primary">
</button>
</div>
);
};

View file

@ -2,6 +2,8 @@ import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { App } from './App';
document.body.classList.add('dark');
// cookieにトークンが入ってたらlocalStorageに移し替える
const token = document.cookie
.split('; ')

View file

@ -29,10 +29,10 @@ export const IndexSessionPage: React.VFC = () => {
<Header />
<div className="xarticle card" style={{borderRadius: 'var(--radius)'}}>
<Tab items={items} selected={selectedTab} onSelect={setSelectedTab}/>
<article className="container">
{component}
</article>
</div>
<article className="xarticle mt-4">
{component}
</article>
</>
);
};

View file

@ -6,25 +6,29 @@ body {
.xarticle {
margin: auto;
max-width: 720px;
overflow: hidden;
}
.skeleton {
border-radius: var(--radius);
background: var(--tone-1);
background: var(--tone-2);
position: relative;
overflow: hidden;
&::after {
content: "";
inset: 0;
position: absolute;
background: linear-gradient(90deg, transparent, var(--tone-2) 50%, transparent 100%);
background: linear-gradient(90deg, transparent, var(--tone-3) 50%, transparent 100%);
animation: 1.2s ease-out 0s infinite skeleton;
}
}
.fade {
animation: 0.3s ease-out 0s fadeIn;
}
.tab {
display: flex;
flex-wrap: wrap;
background: var(--panel);
.item {
position: relative;
@ -67,3 +71,14 @@ body {
transform: translateX(300%);
}
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(-8px);
}
to {
opacity: 1;
transform: none;
}
}