diff --git a/.env.example.development b/.env.example.development new file mode 100644 index 00000000..5f64f7fa --- /dev/null +++ b/.env.example.development @@ -0,0 +1,4 @@ +REACT_APP_AUTH_API_URL=http://localhost:3003 +REACT_APP_APP_API_URL=http://localhost:3007 +REACT_APP_SCORE_API_URL=http://localhost:3005 +REACT_APP_API_PATH=https://api.winds-n.com diff --git a/.env.example.production b/.env.example.production new file mode 100644 index 00000000..171d1ff2 --- /dev/null +++ b/.env.example.production @@ -0,0 +1,4 @@ +REACT_APP_AUTH_API_URL=https://auth.winds-n.com +REACT_APP_APP_API_URL=https://app.winds-n.com +REACT_APP_SCORE_API_URL=https://score.winds-n.com +REACT_APP_API_PATH=https://api.winds-n.com diff --git a/.eslintrc-client.json b/.eslintrc-client.json deleted file mode 100644 index 5f4815d2..00000000 --- a/.eslintrc-client.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "env": { - "browser": true, - "es6": true - }, - "extends": [ - "eslint:recommended", - "plugin:react/recommended" - ], - "globals": { - "Atomics": "readonly", - "SharedArrayBuffer": "readonly" - }, - "parserOptions": { - "ecmaFeatures": { - "jsx": true - }, - "ecmaVersion": 2018, - "sourceType": "module" - }, - "plugins": [ - "react" - ], - "settings": { - "react": { - "version": "detect" - } - }, - "rules": { - "react/prop-types": 0 - } -} \ No newline at end of file diff --git a/.eslintrc-server.json b/.eslintrc-server.json deleted file mode 100644 index d097bf7d..00000000 --- a/.eslintrc-server.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "env": { - "commonjs": true, - "es6": true, - "node": true - }, - "extends": "eslint:recommended", - "globals": { - "Atomics": "readonly", - "SharedArrayBuffer": "readonly" - }, - "parserOptions": { - "ecmaVersion": 2018 - }, - "rules": { - } -} \ No newline at end of file diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index adc72e63..261164f1 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -12,14 +12,16 @@ jobs: strategy: matrix: - node-version: [12.16.3] + node-version: [18.14.0] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - run: yarn install - - run: yarn run lint - - run: yarn run build-prod + - run: yarn lint + - run: yarn typecheck + - run: yarn prettiercheck + - run: yarn build diff --git a/.gitignore b/.gitignore index ec8d505c..fe6ae1a1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,26 @@ -# See https://help.github.com/ignore-files/ for more about ignoring files. +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies /node_modules +/.pnp +.pnp.js -client/build/bundle.js -client/build/bundle.js.map -*.css \ No newline at end of file +# testing +/coverage + +# production +/build + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# env +.env diff --git a/.node-version b/.node-version index 970d890c..e6db45a9 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -v12.16.3 \ No newline at end of file +18.14.0 diff --git a/README.md b/README.md index 308f4deb..e6e8e48d 100644 --- a/README.md +++ b/README.md @@ -68,4 +68,4 @@ Expressサーバが起動します。 ### ウィンズスコア -`score.winds-n.com`を参照 \ No newline at end of file +`score.winds-n.com`を参照 diff --git a/app.js b/app.js deleted file mode 100644 index 08c83b62..00000000 --- a/app.js +++ /dev/null @@ -1,55 +0,0 @@ -const express = require('express') -const app = express() - -const bodyParser = require('body-parser') -app.use(bodyParser.urlencoded({extended: true})) -app.listen(3006) - -const compression = require('compression') -app.use(compression({ - threshold: 0, - level: 9, - memLevel: 9 -})) - -// クライアントアプリを返す -const client = './client/build' -app.use('/', express.static(client)) -app.use('/practice', express.static(client)) -app.use('/practice/source', express.static(client)) -app.use('/practice/history', express.static(client)) -app.use('/manager', express.static(client)) -app.use('/manager/selection', express.static(client)) -app.use('/manager/selection/add', express.static(client)) -app.use('/manager/selection/edit/:id', express.static(client)) -app.use('/manager/selection/detail/:id', express.static(client)) -app.use('/bbs', express.static(client)) -app.use('/bbs/post', express.static(client)) -app.use('/cast', express.static(client)) -app.use('/record', express.static(client)) -app.use('/reg', express.static(client)) -app.use('/login', express.static(client)) -app.use('/archive', express.static(client)) -app.use('/archive/overview/:id', express.static(client)) -app.use('/archive/photo/:id', express.static(client)) -app.use('/archive/video/:id/:track', express.static(client)) -app.use('/archive/video/:id', express.static(client)) -app.use('/score', express.static(client)) -app.use('/score/detail/:id', express.static(client)) -app.use('/score/box', express.static(client)) -app.use('/setting', express.static(client)) -app.use('/setting/name', express.static(client)) -app.use('/setting/email', express.static(client)) -app.use('/setting/valid/:key', express.static(client)) -app.use('/setting/password', express.static(client)) -app.use('/setting/session', express.static(client)) -app.use('/setting/admin', express.static(client)) -app.use('/setting/delete', express.static(client)) -app.use('/setting/score', express.static(client)) -app.use('/setting/score/admin', express.static(client)) -app.use('/setting/score/mail', express.static(client)) -app.use('/setting/terms', express.static(client)) -app.use('/setting/about', express.static(client)) -app.use('/setting/license', express.static(client)) - -app.use('/valid/:key', express.static(client)) \ No newline at end of file diff --git a/client/build/index.html b/client/build/index.html deleted file mode 100644 index c432053a..00000000 --- a/client/build/index.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - 会員専用ページ - - - - - - - - - - -
- - - - - - \ No newline at end of file diff --git a/client/build/sw.js b/client/build/sw.js deleted file mode 100644 index e69de29b..00000000 diff --git a/client/src/Actions/Archive.js b/client/src/Actions/Archive.js deleted file mode 100644 index 6b15c0e2..00000000 --- a/client/src/Actions/Archive.js +++ /dev/null @@ -1,370 +0,0 @@ -import * as request from '../Library/Request' -import * as lib from '../Library/Library' -import { playTime } from '../Library/Library' -import { escapeReg } from '../Component/Auth/Archive/Library/Library' - -import { setDisplayPlayer, audioPause } from './Audio' - -const prefix = 'ARCHIVE_' - -const loading = (loading) => ({ - type: prefix + 'LOADING', - payload: { loading }, -}) - -export const getConcertList = () => { - return async (dispatch, getState) => { - if (!window.localStorage.token) return false - if (getState().archive.concertList) return false - if (getState().archive.loading) return false - dispatch(loading(true)) - const path = lib.getAppPath() + '/api/concert' - const send = { - session: lib.getSession(), - } - request.post(path, send, (err, res) => { - if (err) { - return false - } else { - dispatch(setConcertList(res.body.list.reverse())) - } - dispatch(loading(false)) - }) - } -} - -const setConcertList = (concertList) => ({ - type: prefix + 'SET_CONCERT_LIST', - payload: { concertList }, -}) - -// const setConcertListLoad = (concertListLoad) => ({ -// type: prefix + 'SET_CONCERT_LIST_LOAD', -// payload: { concertListLoad } -// }) - -export const toggleDisplayMain = (displayMain) => { - return async (dispatch) => { - window.localStorage.displayMain = displayMain - dispatch(setDisplayMain(displayMain)) - } -} - -const setDisplayMain = (displayMain) => ({ - type: prefix + 'SET_DISPLAY_MAIN', - payload: { displayMain }, -}) - -export const toggleDisplayMini = (displayMini) => { - return async (dispatch) => { - window.localStorage.displayMini = displayMini - dispatch(setDisplayMini(displayMini)) - } -} - -const setDisplayMini = (displayMini) => ({ - type: prefix + 'SET_DISPLAY_MINI', - payload: { displayMini }, -}) - -export const toggleDisplayOther = (displayOther) => { - return async (dispatch) => { - window.localStorage.displayOther = displayOther - dispatch(setDisplayOther(displayOther)) - } -} - -const setDisplayOther = (displayOther) => ({ - type: prefix + 'SET_DISPLAY_OTHER', - payload: { displayOther }, -}) - -export const setConcertid = (concertid) => ({ - type: prefix + 'SET_OVERVIEW_ID', - payload: { concertid }, -}) - -// Search -const loadingSearch = (loadingSearch) => ({ - type: prefix + 'LOADING_SEARCH', - payload: { loadingSearch }, -}) - -export const setSearchRef = (searchRef) => ({ - type: prefix + 'SET_SEARCH_REF', - payload: { searchRef }, -}) - -export const search = (value) => { - return async (dispatch, getState) => { - dispatch(setSearchQuery(value)) - if (value === '' || !value) return dispatch(resetSearch()) - dispatch(loadingSearch(true)) - const searchResult = getState().archive.concertList.map((item) => { - const concert = item.detail - return concert.data.map((track) => { - const s = new RegExp(escapeReg(value), 'i') - // 演奏会名で一致 - if (concert.title.search(s) >= 0) return { concert, track } - // タイトルで一致 - if (track.title.search(s) >= 0) return { concert, track } - // サブタイトルで一致 - // if (track.addtitle.search(s) >= 0) return {concert: concert, track} - // 作曲者名で一致 - if ((track.composer ? track.composer : '').search(s) >= 0) return { concert, track } - // 編曲者名で一致 - if ((track.arranger ? track.arranger : '').search(s) >= 0) return { concert, track } - }) - }) - dispatch(loadingSearch(false)) - dispatch(setSearchResult(searchResult)) - } -} - -const setSearchQuery = (searchQuery) => ({ - type: prefix + 'SET_SEARCH_QUERY', - payload: { searchQuery }, -}) - -const setSearchResult = (searchResult) => ({ - type: prefix + 'SET_SEARCH_RESULT', - payload: { searchResult }, -}) - -export const resetSearch = () => { - return async (dispatch, getState) => { - dispatch(setSearchQuery('')) - dispatch(setSearchResult(undefined)) - getState().archive.searchRef.focus() - } -} - -// Photo -const loadingPhoto = (loadingPhoto) => ({ - type: prefix + 'LOADING_PHOTO', - payload: { loadingPhoto }, -}) - -export const getPhotoList = () => { - return async (dispatch, getState) => { - if (!window.localStorage.token) return false - if (!getState().archive.concertid) return false - if (getState().archive.photoConcertid === getState().archive.concertid) return false - dispatch(loadingPhoto(true)) - const path = lib.getAppPath() + '/api/photo' - const send = { - session: lib.getSession(), - id: getState().archive.concertid, - } - request.post(path, send, (err, res) => { - if (err) { - return false - } else { - dispatch( - setPhotoList( - getState().archive.concertid, - res.body.list, - res.body.baseSrcThumbnail, - res.body.baseSrcOriginal, - res.body.url - ) - ) - } - dispatch(loadingPhoto(false)) - }) - } -} - -export const resetPhotoList = () => { - return async (dispatch) => { - dispatch(setPhotoList(undefined, undefined, undefined, undefined, undefined)) - } -} - -const setPhotoList = (photoConcertid, photoList, photoBaseSrcThumbnail, photoBaseSrcOriginal, photoUrl) => ({ - type: prefix + 'SET_PHOTO_LIST', - payload: { photoConcertid, photoList, photoBaseSrcThumbnail, photoBaseSrcOriginal, photoUrl }, -}) - -export const setDisplayPhotoSlideModal = (displayPhotoSlideModal, photoNumber) => ({ - type: prefix + 'SET_DISPLAY_PHOTO_SLIDE_MODAL', - payload: { displayPhotoSlideModal, photoNumber }, -}) - -// Video -const loadingVideo = (loadingVideo) => ({ - type: prefix + 'LOADING_VIDEO', - payload: { loadingVideo }, -}) - -export const getVideoList = () => { - return async (dispatch, getState) => { - if (!window.localStorage.token) return false - if (!getState().archive.concertid) return false - if (getState().archive.videoConcertid === getState().archive.concertid) return false - dispatch(loadingVideo(true)) - const path = lib.getAppPath() + '/api/video' - const send = { - session: lib.getSession(), - id: getState().archive.concertid, - } - request.post(path, send, (err, res) => { - if (err) { - return false - } else { - dispatch( - setVideoList(getState().archive.concertid, res.body.list, res.body.baseSrc, res.body.url, res.body.poster) - ) - getState().archive.videoPlayTrack ? dispatch(videoPlayRequest(getState().archive.videoPlayTrack, true)) : false - } - dispatch(loadingVideo(false)) - }) - } -} - -// export const resetVideo = () => { -// return async (dispatch, getState) => { -// dispatch(videoStop()) -// dispatch(setVideoPlayStatus(undefined, undefined)) -// dispatch(setVideoList(undefined, undefined, undefined, undefined, undefined)) -// getState().archive.audioPlayerDisplay ? dispatch(setDisplayPlayer(true)) : false -// dispatch(setDisplayVideoController(false, undefined)) -// } -// } - -const setVideoList = (videoConcertid, videoList, videoBaseSrc, videoUrl, videoPoster) => ({ - type: prefix + 'SET_VIDEO_LIST', - payload: { videoConcertid, videoList, videoBaseSrc, videoUrl, videoPoster }, -}) - -// プレイヤー操作 -export const setVideoRef = (videoRef) => ({ - type: prefix + 'SET_VIDEO_REF', - payload: { videoRef }, -}) - -export const setDisplayVideoController = (displayVideoController, audioPlayerDisplay) => ({ - type: prefix + 'SET_DISPLAY_VIDEO_CONTROLLER', - payload: { displayVideoController, audioPlayerDisplay }, -}) - -export const setLoadingVideoSource = (status) => ({ - type: prefix + 'SET_LOADING_VIDEO_SOURCE', - payload: { loadingVideoSource: status }, -}) - -export const videoLoadPercentUpdate = (percent) => ({ - type: prefix + 'VIDEO_LOAD_PERCENT_UPDATE', - payload: { videoLoadPercent: percent }, -}) - -export const videoPlayUpdate = (videoCurrent, videoDuration) => { - return async (dispatch, getState) => { - if (!getState().archive.displayVideoController && !getState().archive.videoRef.paused) { - const audioPlayerDisplay = getState().audio.displayPlayer || getState().archive.audioPlayerDisplay ? true : false - dispatch(setDisplayVideoController(true, audioPlayerDisplay)) - } - const videoPlayPercent = - videoDuration && videoCurrent ? Math.round((videoCurrent / videoDuration) * 1000) / 10 : undefined - const videoCurrentTime = videoCurrent ? playTime(Math.floor(videoCurrent)) : undefined - const videoDurationTime = videoDuration ? playTime(Math.round(videoDuration)) : undefined - dispatch(setVideoPlayUpdate(videoCurrent, videoCurrentTime, videoDuration, videoDurationTime, videoPlayPercent)) - } -} - -const setVideoPlayUpdate = (videoCurrent, videoCurrentTime, videoDuration, videoDurationTime, videoPlayPercent) => ({ - type: prefix + 'VIDEO_PLAY_UPDATE', - payload: { - videoCurrent, - videoCurrentTime, - videoDuration, - videoDurationTime, - videoPlayPercent, - }, -}) - -const setVideoPlayStatus = (videoPlayStatus, videoPlayTrack) => ({ - type: prefix + 'SET_VIDEO_PLAY_STATUS', - payload: { videoPlayStatus, videoPlayTrack }, -}) - -export const videoPlayRequest = (number, request) => { - return async (dispatch, getState) => { - // オーディオが再生中なら止める - dispatch(audioPause()) - // トラック番号のみ先に反映(先に) - dispatch(setVideoPlayStatus(false, number)) - // プレイヤーを表示(オーディオプレイヤーの状態を記録) - const audioPlayerDisplay = getState().audio.displayPlayer || getState().archive.audioPlayerDisplay ? true : false - dispatch(setDisplayVideoController(true, audioPlayerDisplay)) - // オーディオプレイヤーが表示されていたら隠す - getState().audio.displayPlayer ? dispatch(setDisplayPlayer(false)) : false - // ビデオを再生 - if (request && getState().archive.videoList && getState().archive.videoRef) { - const track = getState().archive.videoList[number] - getState().archive.videoRef.src = getState().archive.videoUrl + getState().archive.videoBaseSrc + track.path - dispatch(videoPlay(number)) - } - // 再生フラグをリセット - dispatch(setCountFlag(true)) - } -} - -export const videoPlay = (number) => { - return async (dispatch, getState) => { - getState().archive.videoRef.play() - dispatch(setVideoPlayStatus(true, number)) - } -} - -export const videoPause = (e) => { - if (e) e.preventDefault() - return async (dispatch, getState) => { - if (!getState().archive.videoRef.paused) { - getState().archive.videoRef.pause() - dispatch(setVideoPlayStatus(false, getState().archive.videoPlayTrack)) - } - } -} - -export const videoStop = (e) => { - if (e) e.preventDefault() - return async (dispatch, getState) => { - getState().archive.videoRef.pause() - getState().archive.videoRef.currentTime = 0 - dispatch(setVideoPlayStatus(false, getState().archive.videoPlayTrack)) - if (!getState().archive.videoCurrent) { - // コントローラを隠す - dispatch(setVideoPlayStatus(undefined, undefined)) - getState().archive.audioPlayerDisplay ? dispatch(setDisplayPlayer(true)) : false - dispatch(setDisplayVideoController(false, undefined)) - getState().archive.videoRef.src = false - } - } -} - -export const resetVideo = () => { - return async (dispatch, getState) => { - getState().archive.videoRef.pause() - dispatch(setVideoPlayStatus(undefined, undefined)) - dispatch(setVideoList(undefined, undefined, undefined, undefined, undefined)) - getState().archive.audioPlayerDisplay ? dispatch(setDisplayPlayer(true)) : false - dispatch(setDisplayVideoController(false, undefined)) - } -} - -export const countUp = () => { - return async (dispatch, getState) => { - const play = { - session: lib.getSession(), - play: getState().archive.videoRef.src + '(' + getState().archive.videoCurrentTime + ')', - } - request.countUp(play) - dispatch(setCountFlag(false)) - } -} - -const setCountFlag = (countFlag) => ({ - type: prefix + 'SET_COUNT_FLAG', - payload: { countFlag }, -}) diff --git a/client/src/Actions/Audio.js b/client/src/Actions/Audio.js deleted file mode 100644 index fdc6fd31..00000000 --- a/client/src/Actions/Audio.js +++ /dev/null @@ -1,443 +0,0 @@ -import * as request from '../Library/Request' -import * as lib from '../Library/Library' -import { playTime } from '../Library/Library' - -import * as libArchive from '../Component/Auth/Archive/Library/Library' -import * as libPractice from '../Component/Auth/Practice/Library/Library' -import * as libSource from '../Component/Auth/Practice/Source/Library/Library' - -const prefix = 'AUDIO_' - -// アーカイブプレイリストの読み込み -export const loadArchivePlaylist = () => { - return async (dispatch, getState) => { - if (!window.localStorage.token) return false - if (getState().audio.archivePlaylist) return false - dispatch(loadingArchivePlaylist(true)) - const path = lib.getAppPath() + '/api/audio' - const send = { - session: lib.getSession(), - } - request.post(path, send, (err, res) => { - if (err) { - return false - } else { - if (res.body.status) { - dispatch(setArchivePlaylist(res.body.list, res.body.url)) - } - } - dispatch(loadingArchivePlaylist(false)) - }) - } -} - -const loadingArchivePlaylist = (loadingArchivePlaylist) => ({ - type: prefix + 'LOADING_ARCHIVE_PLAYLIST', - payload: { loadingArchivePlaylist }, -}) - -const setArchivePlaylist = (archivePlaylist, archiveBaseUrl) => ({ - type: prefix + 'SET_ARCHIVE_PLAYLIST', - payload: { archivePlaylist, archiveBaseUrl }, -}) - -// 練習記録プレイリストの読み込み -export const loadPracticePlaylist = () => { - return async (dispatch, getState) => { - if (!window.localStorage.token) return false - if (getState().audio.practicePlaylist) return false - dispatch(loadingPracticePlaylist(true)) - const path = lib.getAppPath() + '/api/record' - const send = { - session: lib.getSession(), - } - request.post(path, send, (err, res) => { - if (err) { - return false - } else { - if (res.body.status) { - dispatch(setPracticePlaylist(res.body.list, res.body.url)) - } - } - dispatch(loadingPracticePlaylist(false)) - }) - } -} - -const loadingPracticePlaylist = (loadingPracticePlaylist) => ({ - type: prefix + 'LOADING_PRACTICE_PLAYLIST', - payload: { loadingPracticePlaylist }, -}) - -const setPracticePlaylist = (practicePlaylist, practiceBaseUrl) => ({ - type: prefix + 'SET_PRACTICE_PLAYLIST', - payload: { practicePlaylist, practiceBaseUrl }, -}) - -// 参考音源プレイリストの読み込み -export const loadSourcePlaylist = () => { - return async (dispatch, getState) => { - if (!window.localStorage.token) return false - if (getState().audio.sourcePlaylist) return false - dispatch(loadingSourcePlaylist(true)) - const path = lib.getAppPath() + '/api/reference' - const send = { - session: lib.getSession(), - } - request.post(path, send, (err, res) => { - if (err) { - return false - } else { - if (res.body.status) { - if (res.body.list.length === 0) { - dispatch(closePlayer()) - } else { - dispatch(setSourcePlaylist(res.body.list, res.body.url)) - } - } - } - dispatch(loadingSourcePlaylist(false)) - }) - } -} - -const loadingSourcePlaylist = (loadingSourcePlaylist) => ({ - type: prefix + 'LOADING_SOURCE_PLAYLIST', - payload: { loadingSourcePlaylist }, -}) - -const setSourcePlaylist = (sourcePlaylist, sourceBaseUrl) => ({ - type: prefix + 'SET_SOURCE_PLAYLIST', - payload: { sourcePlaylist, sourceBaseUrl }, -}) - -// オーディオタグ本体 -export const setAudioRef = (audioRef) => ({ - type: prefix + 'SET_AUDIO_REF', - payload: { audioRef }, -}) - -// 要素の表示状態 - -// プレイヤーの表示設定 -export const setDisplayPlayer = (displayPlayer) => { - displayPlayer - ? window.localStorage.setItem('displayPlayer', displayPlayer) - : window.localStorage.removeItem('displayPlayer') - return { - type: prefix + 'SET_DISPLAY_PLAYER', - payload: { displayPlayer }, - } -} - -// プレイリストを開く -export const setDisplayPlaylist = (displayPlaylist) => ({ - type: prefix + 'SET_DISPLAY_PLAYLIST', - payload: { displayPlaylist }, -}) - -// オーディオタグの情報 - -// ファイルの読み込みフラグ -export const setLoadingAudio = (status) => ({ - type: prefix + 'LOADING_AUDIO', - payload: { loadingAudio: status }, -}) - -// ファイルの読み込み量更新 -export const loadPercentUpdate = (percent) => ({ - type: prefix + 'LOADING_UPDATE', - payload: { loadPercent: percent }, -}) - -const setPlayStatus = (playStatus) => ({ - type: prefix + 'SET_PLAY_STATUS', - payload: { playStatus }, -}) - -// 再生時間の更新 -export const playUpdate = (current, duration) => { - const playPercent = duration && current ? Math.round((current / duration) * 1000) / 10 : undefined - const currentTime = current ? playTime(Math.floor(current)) : undefined - const durationTime = duration ? playTime(Math.round(duration)) : undefined - return { - type: prefix + 'PLAY_UPDATE', - payload: { - current, - currentTime, - duration, - durationTime, - playPercent, - }, - } -} - -// 曲情報 - -// アーカイブから曲を選択 -export const archivePlayRequest = (concertid, number, playRequest) => { - return async (dispatch, getState) => { - // プレイヤーを表示 - !getState().audio.displayPlayer ? dispatch(setDisplayPlayer(true)) : false - // 練習記録側は削除 - dispatch(practiceSetPlayBase(undefined, undefined, undefined)) - // 再生する曲情報 - dispatch(archiveSetPlayBase(concertid, number)) - // localStorageの記録更新 - dispatch(removePracticeStorage()) - dispatch(removeSourceStorage()) - window.localStorage.setItem('playerConcertid', concertid) - window.localStorage.setItem('playerNumber', number) - // 曲を再生 - playRequest ? dispatch(audioPlay()) : false - // 再生フラグをリセット - dispatch(setCountFlag(true)) - } -} - -// 再生する曲情報を設定 -const archiveSetPlayBase = (concertid, number) => { - return { - type: prefix + 'ARCHIVE_SET_PLAY_BASE', - payload: { playmode: 'archive', concertid, number }, - } -} - -// 練習記録から曲を選択 -export const practicePlayRequest = (practiceid, fileNumber, requestTimeString, playRequest) => { - return async (dispatch, getState) => { - // プレイヤーを表示 - !getState().audio.displayPlayer ? dispatch(setDisplayPlayer(true)) : false - const requestTime = libPractice.timeSecond(requestTimeString) - // アーカイブ側は削除 - dispatch(archiveSetPlayBase(undefined, undefined)) - // 再生する曲情報 - dispatch(practiceSetPlayBase(practiceid, fileNumber, requestTime)) - // localStorageの記録更新 - dispatch(removeArchiveStorage()) - dispatch(removeSourceStorage()) - window.localStorage.setItem('playerPracticeid', practiceid) - window.localStorage.setItem('playerPracticeFile', fileNumber) - // 曲を再生 - playRequest ? dispatch(audioPlay(requestTime)) : false - // 再生フラグをリセット - dispatch(setCountFlag(true)) - } -} - -// 再生する曲情報を設定 -const practiceSetPlayBase = (practiceid, fileNumber, requestTime) => { - return { - type: prefix + 'PRACTICE_SET_PLAY_BASE', - payload: { playmode: 'practice', practiceid, fileNumber, requestTime }, - } -} - -// 参考音源から曲を選択 -export const sourcePlayRequest = (sourceid, sourceNumber, playRequest) => { - return async (dispatch, getState) => { - // プレイヤーを表示 - !getState().audio.displayPlayer ? dispatch(setDisplayPlayer(true)) : false - // アーカイブ側は削除 - dispatch(archiveSetPlayBase(undefined, undefined)) - // 再生する曲情報 - dispatch(sourceSetPlayBase(sourceid, sourceNumber)) - // localStorageの記録更新 - dispatch(removeArchiveStorage()) - dispatch(removePracticeStorage()) - window.localStorage.setItem('playerSourceid', sourceid) - window.localStorage.setItem('playerSourceNumber', sourceNumber) - // 曲を再生 - playRequest ? dispatch(audioPlay()) : false - // 再生フラグをリセット - dispatch(setCountFlag(true)) - } -} - -// 再生する曲情報を設定 -const sourceSetPlayBase = (sourceid, sourceNumber) => { - return { - type: prefix + 'SOURCE_SET_PLAY_BASE', - payload: { playmode: 'source', sourceid, sourceNumber }, - } -} - -const removeArchiveStorage = () => { - return async () => { - window.localStorage.removeItem('playerConcertid') - window.localStorage.removeItem('playerNumber') - } -} -const removePracticeStorage = () => { - return async () => { - window.localStorage.removeItem('playerPracticeid') - window.localStorage.removeItem('playerPracticeFile') - } -} -const removeSourceStorage = () => { - return async () => { - window.localStorage.removeItem('playerSourceid') - window.localStorage.removeItem('playerSourceNumber') - } -} - -// オーディオタグの操作 - -// 再生・一時停止ボタン -export const audioPlay = (requestTime) => { - return async (dispatch, getState) => { - if (getState().audio.playmode === 'archive') { - if (!getState().archive.concertList) return false - if (!getState().audio.archivePlaylist) return false - const album = libArchive.getAlbum(getState().audio.concertid, getState().audio.archivePlaylist) - const track = album.list[getState().audio.number] - // dispatch(archiveSetPlay(album, track, true)) - // タグに反映 - if ( - !getState().audio.audioRef.src || - getState().audio.audioRef.src !== getState().audio.archiveBaseUrl + album.baseSrc + track.path - ) { - getState().audio.audioRef.src = getState().audio.archiveBaseUrl + album.baseSrc + track.path - } - // 曲が指定されていないとき - if (isNaN(getState().audio.number)) { - if (getState().audio.displayPlaylist) { - return // Actions.toastShow('曲を選択してください') - } else { - if (getState().audio.playlistLoad) { - return dispatch(setDisplayPlaylist(true)) - } else { - return - } - } - } - } else if (getState().audio.playmode === 'practice') { - if (!getState().history.list) return false - if (!getState().audio.practicePlaylist) return false - const practiceAlbum = libPractice.getPracticeAlbum(getState().audio.practiceid, getState().audio.practicePlaylist) - const file = practiceAlbum.file[getState().audio.fileNumber] - // dispatch(practiceSetPlay(practiceAlbum, file, true)) - // タグに反映 - if ( - !getState().audio.audioRef.src || - getState().audio.audioRef.src !== getState().audio.practiceBaseUrl + practiceAlbum.directory + file.path - ) { - getState().audio.audioRef.src = getState().audio.practiceBaseUrl + practiceAlbum.directory + file.path - } - if (isFinite(requestTime)) getState().audio.audioRef.currentTime = requestTime - } else if (getState().audio.playmode === 'source') { - if (!getState().source.list) return false - if (!getState().audio.sourcePlaylist) return false - const album = libSource.getAlbum(getState().audio.sourceid, getState().audio.sourcePlaylist) - const track = album.list[getState().audio.sourceNumber] - // タグに反映 - if ( - !getState().audio.audioRef.src || - getState().audio.audioRef.src !== getState().audio.sourceBaseUrl + album.baseSrc + track.path - ) { - getState().audio.audioRef.src = getState().audio.sourceBaseUrl + album.baseSrc + track.path - } - // 曲が指定されていないとき - if (isNaN(getState().audio.sourceNumber)) { - if (getState().audio.displayPlaylist) { - return // Actions.toastShow('曲を選択してください') - } else { - if (getState().audio.playlistLoad) { - return dispatch(setDisplayPlaylist(true)) - } else { - return - } - } - } - } - dispatch(audioStart()) - } -} - -const audioStart = () => { - return async (dispatch, getState) => { - if (getState().audio.audioRef) { - if (getState().audio.audioRef.paused) { - getState().audio.audioRef.play() - dispatch(setPlayStatus(true)) - } - } - } -} - -export const audioPause = () => { - return async (dispatch, getState) => { - if (getState().audio.audioRef) { - if (!getState().audio.audioRef.paused) { - getState().audio.audioRef.pause() - dispatch(setPlayStatus(false)) - } - } - } -} - -export const audioStop = (button) => { - return async (dispatch, getState) => { - if (!getState().audio.current) { - dispatch(setDisplayPlaylist(false)) - dispatch(setDisplayPlayer(false)) - if (button) { - dispatch(removeArchiveStorage()) - dispatch(removePracticeStorage()) - dispatch(removeSourceStorage()) - window.localStorage.removeItem('displayPlayer') - } - } - getState().audio.audioRef.pause() - getState().audio.audioRef.currentTime = 0 - dispatch(setPlayStatus(false)) - } -} - -export const audioBackward = () => { - return async (dispatch, getState) => { - getState().audio.audioRef.currentTime = getState().audio.audioRef.currentTime - 10 - } -} - -export const audioForward = () => { - return async (dispatch, getState) => { - getState().audio.audioRef.currentTime = getState().audio.audioRef.currentTime + 10 - } -} - -export const closePlayer = () => { - return async (dispatch) => { - dispatch(audioStop()) - dispatch(setDisplayPlayer(false)) - dispatch(removeArchiveStorage()) - dispatch(removePracticeStorage()) - dispatch(removeSourceStorage()) - } -} - -export const countUp = () => { - return async (dispatch, getState) => { - const play = { - session: lib.getSession(), - play: getState().audio.audioRef.src + '(' + getState().audio.currentTime + ')', - } - request.countUp(play) - dispatch(setCountFlag(false)) - } -} - -export const countPlay = (time) => { - return async (dispatch, getState) => { - const seek = { - session: lib.getSession(), - seek: getState().audio.audioRef.src + '(' + lib.playTime(time) + ')', - } - request.sendSeek(seek) - } -} - -const setCountFlag = (countFlag) => ({ - type: prefix + 'SET_COUNT_FLAG', - payload: { countFlag }, -}) diff --git a/client/src/Actions/BBS.js b/client/src/Actions/BBS.js deleted file mode 100644 index 4e4a2dd0..00000000 --- a/client/src/Actions/BBS.js +++ /dev/null @@ -1,135 +0,0 @@ -import { replace } from 'react-router-redux' -import * as request from '../Library/Request' -import * as lib from '../Library/Library' - -import { showToast } from './Toast' - -const prefix = 'BBS_' - -const getApi = () => { - return new Promise((resolve) => { - const path = lib.getAppPath() + '/api/bbs' - const send = { session: lib.getSession() } - request.post(path, send, (err, res) => { - if (err) { - resolve(false) - } else { - resolve(res.body.api) - } - }) - }) -} - -export const getBBSList = () => { - return async (dispatch, getState) => { - if (!window.localStorage.token) return false - if (getState().bbs.acquired) return false - dispatch(loading(true)) - // 既に読み込んでるデータをリセット - dispatch(updateList(undefined)) - dispatch(showListUpdate([], 0, true)) - const api = await getApi() - const path = lib.getApiPath() + '/bbs/' // スラッシュ必須 - const send = { api } - request.post(path, send, (err, res) => { - if (err) { - return false - } else if (res.body.status === 'true') { - dispatch(updateList(res.body.list)) - dispatch(loadMore()) - dispatch(acquired(true)) - } - dispatch(loading(false)) - }) - } -} - -const updateList = (list) => ({ - type: prefix + 'UPDATE', - payload: { list }, -}) - -export const loadMore = () => { - return async (dispatch, getState) => { - const prevCount = getState().bbs.showCount - const showCount = prevCount + 5 - const list = getState().bbs.list - const showList = getState().bbs.showList.concat(list.slice(prevCount, showCount)) - const showMore = showCount > list.length ? false : true - dispatch(showListUpdate(showList, showCount, showMore)) - } -} - -const showListUpdate = (showList, showCount, showMore) => ({ - type: prefix + 'SHOW_LIST_UPDATE', - payload: { showList, showCount, showMore }, -}) - -const acquired = (acquired) => ({ - type: prefix + 'ACQUIRED', - payload: { acquired }, -}) - -const loading = (loading) => ({ - type: prefix + 'LOADING', - payload: { loading }, -}) - -// Post -const loadingPost = (loadingPost) => ({ - type: prefix + 'LOADING_POST', - payload: { loadingPost }, -}) - -export const setPostName = (postName) => ({ - type: prefix + 'SET_POST_NAME', - payload: { postName }, -}) - -export const setPostText = (postText) => ({ - type: prefix + 'SET_POST_TEXT', - payload: { postText }, -}) - -export const setPostPass = (postPass) => ({ - type: prefix + 'SET_POST_PASS', - payload: { postPass }, -}) - -export const sendPost = () => { - return async (dispatch, getState) => { - if (!window.localStorage.token) return false - if (getState().bbs.postName === '' || getState().bbs.postText === '') { - dispatch(showToast('入力内容を確認してください')) - return false - } - dispatch(loadingPost(true)) - const api = await getApi() - const path = lib.getApiPath() + '/bbs/' // スラッシュ必須 - const send = { - api, - write: true, - name: getState().bbs.postName, - text: getState().bbs.postText, - delpass: getState().bbs.postPass, - } - request.post(path, send, (err, res) => { - if (err) { - return false - } else if (res.body.status === 'true') { - dispatch(resetPost()) - dispatch(acquired(false)) - dispatch(replace('/bbs')) - } - dispatch(loadingPost(false)) - }) - } -} - -export const resetPost = () => { - return async (dispatch) => { - dispatch(setPostName('')) - dispatch(setPostText('')) - dispatch(setPostPass('')) - } -} diff --git a/client/src/Actions/EmailValidation.js b/client/src/Actions/EmailValidation.js deleted file mode 100644 index 6488b9de..00000000 --- a/client/src/Actions/EmailValidation.js +++ /dev/null @@ -1,158 +0,0 @@ -import { replace } from 'react-router-redux' - -import * as Status from './Status' -import * as request from '../Library/Request' -import * as lib from '../Library/Library' -import { getUser } from './Setting' -import { showToast } from './Toast' - -const prefix = 'EMAIL_VALIDATION_' - -const loading = (loading) => ({ - type: prefix + 'LOADING', - payload: { loading }, -}) - -export const setKey = (key) => ({ - type: prefix + 'SET_KEY', - payload: { key }, -}) - -export const checkAuth = (key) => { - return (dispatch) => { - if (window.localStorage.token) dispatch(replace('/setting/valid/' + key)) - } -} - -export const requestLogin = () => { - return async (dispatch, getState) => { - // 送信済みの場合キャンセル - if (getState().emailValidation.loading) return - const { - emailValidation: { windsid, password }, - } = getState() - if (windsid === '' || password === '') return dispatch(setErrorMessage('入力を確認してください')) - dispatch(loading(true)) - const path = lib.getAuthPath() + '/login' - const send = { - userid: windsid, - passwd: password, - clientid: lib.getClientid(), - useragent: window.navigator.userAgent, - version: lib.version, - } - request.post(path, send, (err, res) => { - if (err) { - dispatch(setErrorMessage('ログインできませんでした')) - } else { - if (res.body.status) { - // location.reload() - // dispatch(showToast('ログインしました')) - dispatch(Status.windsidUpdate(windsid)) - dispatch(Status.tokenUpdate(res.body.token)) - dispatch(Status.loginUpdate(true)) - dispatch(Status.setUser(res.body.user)) - dispatch(replace('/setting/valid/' + getState().emailValidation.key)) - } else { - dispatch(Status.windsidUpdate(false)) - dispatch(Status.tokenUpdate(false)) - dispatch(Status.loginUpdate(false)) - dispatch(setErrorMessage('ログインできませんでした')) - } - } - dispatch(changePassword('')) - dispatch(loading(false)) - }) - } -} - -export const requestValid = (key) => { - return async (dispatch, getState) => { - // 送信済みの場合キャンセル - if (getState().emailValidation.loading) return - dispatch(loading(true)) - const path = lib.getAuthPath() + '/user/valid' - const send = { - session: lib.getSession(), - key, - } - request.post(path, send, (err, res) => { - if (err) { - dispatch(Status.windsidUpdate(false)) - dispatch(Status.tokenUpdate(false)) - dispatch(Status.loginUpdate(false)) - dispatch(setErrorMessage('管理者に問い合わせてください')) - return - } else { - // res.body.status はログイン試行の結果 - if (res.body.status) { - res.body.valid ? dispatch(setValid(true)) : dispatch(setValid(false)) - res.body.err ? dispatch(setError(res.body.err)) : false - dispatch(Status.setUser(res.body.user)) - } else { - dispatch(setValid(false)) - dispatch(Status.windsidUpdate(false)) - dispatch(Status.tokenUpdate(false)) - dispatch(Status.loginUpdate(false)) - dispatch(setErrorMessage('ログインできませんでした')) - } - } - dispatch(loading(false)) - }) - } -} - -export const requestEmail = () => { - return async (dispatch, getState) => { - // 送信済みの場合キャンセル - if (getState().emailValidation.loading) return - if (!getState().status.user.email) return - dispatch(loading(true)) - const path = lib.getAuthPath() + '/api/setting/email' - const send = { - session: lib.getSession(), - text: getState().status.user.email, - } - request.post(path, send, (err, res) => { - dispatch(loading(false)) - if (err) return dispatch(showToast('エラーが発生しました')) - if (res.body.status && res.body.valid) { - dispatch(getUser()) - dispatch(showToast('確認済みです')) - return - } - if (res.body.status) return dispatch(showToast('確認メールを再送しました')) - }) - } -} - -const setValid = (valid) => ({ - type: prefix + 'SET_VALID', - payload: { valid }, -}) - -export const changeWindsid = (windsid) => ({ - type: 'LOGIN_INPUT_WINDSID', - payload: { - windsid, - }, -}) - -export const changePassword = (password) => ({ - type: 'LOGIN_INPUT_PASSWORD', - payload: { - password, - }, -}) - -const setError = (err) => ({ - type: prefix + 'SET_ERROR', - payload: { err }, -}) - -const setErrorMessage = (str) => ({ - type: prefix + 'SET_ERROR_MESSAGE', - payload: { - errorMessage: str, - }, -}) diff --git a/client/src/Actions/History.js b/client/src/Actions/History.js deleted file mode 100644 index 1e8dd75d..00000000 --- a/client/src/Actions/History.js +++ /dev/null @@ -1,54 +0,0 @@ -import * as request from '../Library/Request' -import * as lib from '../Library/Library' - -const prefix = 'HISTORY_' - -const loading = (loading) => ({ - type: prefix + 'LOADING', - payload: { loading }, -}) - -export const getHistory = () => { - return async (dispatch, getState) => { - if (!window.localStorage.token) return false - if (getState().history.acquired) return false - dispatch(loading(true)) - const path = lib.getAppPath() + '/api/practice' - const send = { - session: lib.getSession(), - } - request.post(path, send, (err, res) => { - if (err) { - return false - } else { - const reverseList = res.body.list.reverse() - dispatch(setList(reverseList)) - dispatch(showListUpdate(reverseList.slice(0, 10))) - dispatch(acquired(true)) - } - dispatch(loading(false)) - }) - } -} - -const setList = (list) => ({ - type: prefix + 'SET_LIST', - payload: { list }, -}) - -export const loadMore = () => { - return async (dispatch, getState) => { - const showList = getState().history.showList.concat(getState().history.list.slice(10)) - dispatch(showListUpdate(showList)) - } -} - -const showListUpdate = (showList) => ({ - type: prefix + 'SHOW_LIST_UPDATE', - payload: { showList }, -}) - -const acquired = (acquired) => ({ - type: prefix + 'ACQUIRED', - payload: { acquired }, -}) diff --git a/client/src/Actions/Login.js b/client/src/Actions/Login.js deleted file mode 100644 index 67299b1e..00000000 --- a/client/src/Actions/Login.js +++ /dev/null @@ -1,74 +0,0 @@ -import { replace } from 'react-router-redux' - -import * as Status from './Status' -import * as request from '../Library/Request' -import * as lib from '../Library/Library' -import { showToast } from './Toast' - -export const login = () => { - return async (dispatch, getState) => { - const { - login: { windsid, password }, - } = getState() - if (windsid === '' || password === '') return dispatch(setErrorMessage('入力を確認してください')) - dispatch(loading(true)) - const path = lib.getAuthPath() + '/login' - const send = { - userid: windsid, - passwd: password, - clientid: lib.getClientid(), - useragent: window.navigator.userAgent, - version: lib.version, - } - request.post(path, send, (err, res) => { - if (err) { - dispatch(setErrorMessage('ログインできませんでした')) - } else { - if (res.body.status) { - // location.reload() - dispatch(showToast('ログインしました')) - dispatch(Status.windsidUpdate(windsid)) - dispatch(Status.tokenUpdate(res.body.token)) - dispatch(Status.loginUpdate(true)) - dispatch(Status.setUser(res.body.user)) - dispatch(replace('/')) - } else { - dispatch(Status.windsidUpdate(false)) - dispatch(Status.tokenUpdate(false)) - dispatch(Status.loginUpdate(false)) - dispatch(setErrorMessage('ログインできませんでした')) - } - } - dispatch(changePassword('')) - dispatch(loading(false)) - }) - } -} - -export const loading = (loading) => ({ - type: 'LOGIN_LOADING', - payload: { - loading: loading, - }, -}) - -export const changeWindsid = (windsid) => ({ - type: 'LOGIN_INPUT_WINDSID', - payload: { - windsid, - }, -}) - -export const changePassword = (password) => ({ - type: 'LOGIN_INPUT_PASSWORD', - payload: { - password, - }, -}) - -export const setErrorMessage = (str) => ({ - type: 'LOGIN_ERROR', - payload: { - errorMessage: str, - }, -}) diff --git a/client/src/Actions/Manager.js b/client/src/Actions/Manager.js deleted file mode 100644 index 545a87be..00000000 --- a/client/src/Actions/Manager.js +++ /dev/null @@ -1,330 +0,0 @@ -import { replace } from 'react-router-redux' -import * as request from '../Library/Request' -import * as lib from '../Library/Library' -import { showToast } from './Toast' -import * as libManager from '../Component/Auth/Manager/Library/Library' - -const prefix = 'MANAGER_' - -export const getManager = () => { - return async (dispatch, getState) => { - if (!window.localStorage.token) return false - if (getState().manager.acquired) return false - dispatch(loading(true)) - const path = lib.getApiPath() + '/manager/' - request.post(path, {}, (err, res) => { - if (err) { - return false - } else { - dispatch(update(res.body)) - dispatch(acquired(true)) - } - dispatch(loading(false)) - }) - } -} - -export const update = (data) => ({ - type: prefix + 'UPDATE', - payload: { data }, -}) - -export const acquired = (acquired) => ({ - type: prefix + 'ACQUIRED', - payload: { acquired }, -}) - -export const loading = (loading) => ({ - type: prefix + 'LOADING', - payload: { loading }, -}) - -// Selection Components -export const getSelectionPhase = () => { - return async (dispatch) => { - if (!window.localStorage.token) return false - dispatch(loadingSelectionPhase(true)) - const path = lib.getSurveyPath() + '/api/selection/phase' - const send = { - session: lib.getSession(), - } - request.post(path, send, (err, res) => { - if (err) { - dispatch(setSelectionPhase(false)) - } else { - dispatch(setSelectionPhase(res.body.phase)) - } - dispatch(loadingSelectionPhase(false)) - }) - } -} - -const loadingSelectionPhase = (loadingSelectionPhase) => ({ - type: prefix + 'LOADING_SELECTION_PHASE', - payload: { loadingSelectionPhase }, -}) - -const setSelectionPhase = (selectionPhase) => ({ - type: prefix + 'SET_SELECTION_PHASE', - payload: { selectionPhase }, -}) - -// Selection List -export const getSelectionList = () => { - return async (dispatch) => { - dispatch(loadingSelectionList(true)) - dispatch(getSelectionListSearch('')) - } -} - -export const changeSearchQuery = (searchQuery) => { - return (dispatch) => { - dispatch(loadingSelectionListSearch(true)) - dispatch(getSelectionListSearch(searchQuery)) - dispatch(setSearchQuery(searchQuery)) - } -} - -export const resetSearchQuery = () => { - return async (dispatch, getState) => { - dispatch(changeSearchQuery('')) - getState().manager.searchBoxRef.focus() - } -} - -export const getSelectionListSearch = (query) => { - return async (dispatch) => { - if (!window.localStorage.token) return false - const requestTime = String(new Date().getTime()) - !window.localStorage.scoreLoadList ? window.localStorage.setItem('scoreLoadList', requestTime) : false - if (requestTime > window.localStorage.scoreLoadList) window.localStorage.setItem('scoreLoadList', requestTime) - const path = lib.getSurveyPath() + '/api/selection/list' - const send = { - session: lib.getSession(), - query, - sort: localStorage.getItem('selectionSort') ? localStorage.getItem('selectionSort') : 'createdAt', - order: localStorage.getItem('selectionOrder') ? localStorage.getItem('selectionOrder') : '1', - } - request.post(path, send, (err, res) => { - dispatch(loadingSelectionList(false)) - dispatch(loadingSelectionListSearch(false)) - if (err) { - dispatch(setSelectionList(false)) - } else { - if (res.body.status && window.localStorage.scoreLoadList === requestTime) { - dispatch(setSelectionList(res.body.list)) - } - } - }) - } -} - -const loadingSelectionList = (loadingSelectionList) => ({ - type: prefix + 'LOADING_SELECTION_LIST', - payload: { loadingSelectionList }, -}) - -const loadingSelectionListSearch = (loadingSelectionListSearch) => ({ - type: prefix + 'LOADING_SELECTION_LIST_SEARCH', - payload: { loadingSelectionListSearch }, -}) - -export const setSearchQuery = (searchQuery) => ({ - type: prefix + 'SET_SEARCH_QUERY', - payload: { searchQuery }, -}) - -const setSelectionList = (selectionList) => ({ - type: prefix + 'SET_SELECTION_LIST', - payload: { selectionList }, -}) - -export const setSearchBoxRef = (searchBoxRef) => ({ - type: prefix + 'SET_SEARCH_BOX_REF', - payload: { searchBoxRef }, -}) - -// Selection Like -export const getSelectionLike = () => { - return async (dispatch) => { - if (!window.localStorage.token) return false - dispatch(loadingSelectionLike(true)) - const path = lib.getSurveyPath() + '/api/selection/like/get' - const send = { - session: lib.getSession(), - } - request.post(path, send, (err, res) => { - if (err) { - dispatch(setSelectionLike(false)) - } else { - dispatch(setSelectionLike(res.body.like)) - } - dispatch(loadingSelectionLike(false)) - }) - } -} - -const loadingSelectionLike = (loadingSelectionLike) => ({ - type: prefix + 'LOADING_SELECTION_LIKE', - payload: { loadingSelectionLike }, -}) - -const setSelectionLike = (selectionLike) => ({ - type: prefix + 'SET_SELECTION_LIKE', - payload: { selectionLike }, -}) - -export const sendSelectionLike = (selectionid) => { - return async (dispatch, getState) => { - if (!window.localStorage.token) return false - if ('removed' in getState().manager.selectionDetail) return false - if (getState().manager.selectionPhase !== 'getmusic' && !libManager.admin(getState().status.user)) return false - dispatch(loadingSelectionSendLike(true)) - const path = lib.getSurveyPath() + '/api/selection/like/add' - const send = { - session: lib.getSession(), - selectionid, - likeUserid: getState().status.user._id, - userid: getState().status.user.userid, - } - request.post(path, send, (err, res) => { - if (err) { - dispatch(setSelectionLike(false)) - } else { - if (res.body.status) dispatch(getSelectionLike()) - } - dispatch(loadingSelectionSendLike(false)) - }) - } -} - -const loadingSelectionSendLike = (loadingSelectionSendLike) => ({ - type: prefix + 'LOADING_SELECTION_SEND_LIKE', - payload: { loadingSelectionSendLike }, -}) - -// Selection Post -export const getSelectionPost = (id) => { - return async (dispatch) => { - if (!window.localStorage.token) return false - dispatch(loadingSelectionPostDetail(true)) - const path = lib.getSurveyPath() + '/api/selection/detail' - const send = { - session: lib.getSession(), - id, - } - request.post(path, send, (err, res) => { - dispatch(loadingSelectionPostDetail(false)) - if (err) { - dispatch(setSelectionPost(false)) - } else { - dispatch(setSelectionPost(res.body.selection)) - } - }) - } -} - -const loadingSelectionPostDetail = (loadingSelectionPostDetail) => ({ - type: prefix + 'LOADING_SELECTION_POST_DETAIL', - payload: { loadingSelectionPostDetail }, -}) - -export const setSelectionPostid = (selectionPostid) => ({ - type: prefix + 'SET_SELECTION_POSTID', - payload: { selectionPostid }, -}) - -export const setSelectionPost = (selectionPost) => ({ - type: prefix + 'SET_SELECTION_POST', - payload: { selectionPost }, -}) - -export const sendPost = (removeRequest) => { - return async (dispatch, getState) => { - if (!window.localStorage.token) return false - if (!getState().manager.selectionPost.title) { - return dispatch(showToast('入力内容を確認してください')) - } - removeRequest ? dispatch(loadingSelectionRemovePost(true)) : dispatch(loadingSelectionPost(true)) - const path = lib.getSurveyPath() + '/api/selection/post' - const send = { - session: lib.getSession(), - id: getState().manager.selectionPostid, - postUserid: getState().status.user._id, - selection: getState().manager.selectionPost, - remove: removeRequest ? true : false, - } - request.post(path, send, (err, res) => { - removeRequest ? dispatch(loadingSelectionRemovePost(false)) : dispatch(loadingSelectionPost(false)) - if (err) { - dispatch(showToast('サーバーエラー')) - } else { - if (res.body.status) { - if (removeRequest && getState().manager.selectionPostid) { - dispatch(showToast('削除しました')) - dispatch(replace('/manager/selection')) - } else if (getState().manager.selectionPostid) { - dispatch(showToast('更新しました')) - dispatch(replace('/manager/selection/detail/' + getState().manager.selectionPostid)) - } else { - dispatch(showToast('投稿しました')) - dispatch(replace('/manager/selection')) - } - } else { - dispatch(showToast('サーバーエラー')) - } - } - }) - } -} - -const loadingSelectionPost = (loadingSelectionPost) => ({ - type: prefix + 'LOADING_SELECTION_POST', - payload: { loadingSelectionPost }, -}) - -const loadingSelectionRemovePost = (loadingSelectionRemovePost) => ({ - type: prefix + 'LOADING_SELECTION_REMOVE_POST', - payload: { loadingSelectionRemovePost }, -}) - -// Selection Detail -export const getSelectionDetail = (id) => { - return async (dispatch) => { - if (!window.localStorage.token) return false - dispatch(loadingSelectionDetail(true)) - dispatch(setSelectionDetailid(id)) - const path = lib.getSurveyPath() + '/api/selection/detail' - const send = { - session: lib.getSession(), - id, - } - request.post(path, send, (err, res) => { - dispatch(loadingSelectionDetail(false)) - if (err) { - dispatch(setSelectionDetail(false)) - } else { - if (res.body.status) { - dispatch(setSelectionDetail(res.body.selection)) - } else { - dispatch(setSelectionDetail({ removed: true })) - } - } - }) - } -} - -const loadingSelectionDetail = (loadingSelectionDetail) => ({ - type: prefix + 'LOADING_SELECTION_DETAIL', - payload: { loadingSelectionDetail }, -}) - -export const setSelectionDetailid = (selectionDetailid) => ({ - type: prefix + 'SET_SELECTION_DETAILID', - payload: { selectionDetailid }, -}) - -export const setSelectionDetail = (selectionDetail) => ({ - type: prefix + 'SET_SELECTION_DETAIL', - payload: { selectionDetail }, -}) diff --git a/client/src/Actions/Navigation.js b/client/src/Actions/Navigation.js deleted file mode 100644 index b7398cff..00000000 --- a/client/src/Actions/Navigation.js +++ /dev/null @@ -1,39 +0,0 @@ -import { replace } from 'react-router-redux' - -export const redirect = (location) => { - return async (dispatch) => { - dispatch(replace(location)) - } -} - -const prefix = 'NAVIGATION_' -export const navigationMenuToggle = () => { - return (dispatch, getState) => { - dispatch(navigationMenu(!getState().navigation.menuOpen)) - } -} - -export const navigationMenu = (menuOpen) => ({ - type: prefix + 'MENU', - payload: { menuOpen }, -}) - -export const setNavigationTitle = (title) => ({ - type: prefix + 'SET_NAVIGATION_TITLE', - payload: { title }, -}) - -export const setNavigationTitleArchiveConcertid = (titleConcertid) => ({ - type: prefix + 'SET_NAVIGATION_TITLE_ARCHIVE_CONCERT_ID', - payload: { titleConcertid }, -}) - -export const setBackNavigation = (backNavigation, backNavigationPath) => ({ - type: prefix + 'SET_BACKLINK', - payload: { backNavigation, backNavigationPath }, -}) - -export const releaseBackNavigation = () => ({ - type: prefix + 'SET_BACKLINK', - payload: { backNavigation: false, backNavigationPath: undefined }, -}) diff --git a/client/src/Actions/Reg.js b/client/src/Actions/Reg.js deleted file mode 100644 index 36604fe4..00000000 --- a/client/src/Actions/Reg.js +++ /dev/null @@ -1,108 +0,0 @@ -import { replace } from 'react-router-redux' - -import * as Status from './Status' -import * as request from '../Library/Request' -import * as lib from '../Library/Library' -// import { requestFirstTutorial } from './Tutorial' - -export const register = () => { - return async (dispatch, getState) => { - const { - reg: { windsid, password, approvalKey }, - } = getState() - if (windsid === '' || password === '' || approvalKey === '') { - dispatch(resetMode()) - return dispatch(setErrorMessage('入力を確認してください')) - } - dispatch(loading(true)) - const path = lib.getAuthPath() + '/adduser' - const send = { - userid: windsid, - passwd: password, - key: approvalKey, - clientid: lib.getClientid(), - useragent: window.navigator.userAgent, - version: lib.version, - } - request.post(path, send, (err, res) => { - if (err) { - dispatch(setErrorMessage('登録できませんでした')) - dispatch(resetMode()) - } else { - if (res.body.status) { - // location.reload() - dispatch(Status.windsidUpdate(windsid)) - dispatch(Status.tokenUpdate(res.body.token)) - dispatch(Status.loginUpdate(true)) - dispatch(Status.setUser(res.body.user)) - dispatch(replace('/')) - // dispatch(requestFirstTutorial(true, 'first')) - } else { - dispatch(Status.windsidUpdate(false)) - dispatch(Status.tokenUpdate(false)) - dispatch(Status.loginUpdate(false)) - dispatch(setErrorMessage('登録できませんでした')) - dispatch(resetMode()) - } - } - dispatch(changePassword('')) - dispatch(changeKey('')) - dispatch(loading(false)) - }) - } -} - -export const loading = (loading) => ({ - type: 'REG_LOADING', - payload: { - loading: loading, - }, -}) - -export const updateMode = () => { - return async (dispatch) => { - dispatch(loading(true)) - setTimeout(() => { - dispatch(loading(false)) - dispatch(setMode(true)) - }, 200) - } -} - -const setMode = (mode) => ({ - type: 'REG_SET_MODE', - payload: { mode }, -}) - -export const resetMode = () => ({ - type: 'REG_SET_MODE', - payload: { mode: false }, -}) - -export const changeWindsid = (windsid) => ({ - type: 'REG_INPUT_WINDSID', - payload: { - windsid, - }, -}) - -export const changePassword = (password) => ({ - type: 'REG_INPUT_PASSWORD', - payload: { - password, - }, -}) - -export const changeKey = (approvalKey) => ({ - type: 'REG_INPUT_KEY', - payload: { - approvalKey, - }, -}) - -export const setErrorMessage = (str) => ({ - type: 'REG_ERROR', - payload: { - errorMessage: str, - }, -}) diff --git a/client/src/Actions/Schedule.js b/client/src/Actions/Schedule.js deleted file mode 100644 index d377d6fc..00000000 --- a/client/src/Actions/Schedule.js +++ /dev/null @@ -1,41 +0,0 @@ -import * as request from '../Library/Request' -import * as lib from '../Library/Library' - -export const getSchedule = () => { - return async (dispatch, getState) => { - if (!window.localStorage.token) return false - if (getState().schedule.acquired) return false - dispatch(loading(true)) - const path = lib.getApiPath() + '/schedule/' - request.post(path, {}, (err, res) => { - if (err) { - return false - } else { - dispatch(update(res.body)) - dispatch(acquired(true)) - } - dispatch(loading(false)) - }) - } -} - -export const update = (data) => ({ - type: 'SCHEDULE_UPDATE', - payload: { - data, - }, -}) - -export const acquired = (acquired) => ({ - type: 'SCHEDULE_ACQUIRED', - payload: { - acquired, - }, -}) - -export const loading = (loading) => ({ - type: 'SCHEDULE_LOADING', - payload: { - loading: loading, - }, -}) diff --git a/client/src/Actions/Score.js b/client/src/Actions/Score.js deleted file mode 100644 index 30aac3b3..00000000 --- a/client/src/Actions/Score.js +++ /dev/null @@ -1,326 +0,0 @@ -import * as request from '../Library/Request' -import * as lib from '../Library/Library' -import { scrollToTop } from './Status' -import { showToast } from './Toast' - -const prefix = 'SCORE_' - -// 新しい楽譜を追加するときはこれをコピーする -const newScoreObject = Object.freeze({ - // const newScoreObject = { - // 楽譜番号(初期値) - number: 1, - // タイトル(日本語) - titleJa: '', - // タイトル(英語) - titleEn: '', - // 作曲者 - composer: [''], - // 編曲者 - arranger: [''], - // 出版社 - publisher: '', - // ジャンル - genre: '', - // 譜面の種類(0: 原譜, 1: コピー譜) - scoreType: '0', - // コピー元 - copyMemo: '', - // 楽譜の状態(0: 保管中, 1: 使用中, 2: 貸出中) - scoreStatus: '0', - // 欠譜の状態(0: なし, 1: あり, 2: 未確認) - scoreLack: '0', - // 欠譜 - lackList: [''], - // 貸出先 - lendLocate: '', - // 原譜化の状態(0: 原譜化済[stable]) - scoreBased: '0', - // 楽譜管理番号 - label: '000001', - // 楽譜保管先 - boxLabel: '', -}) -// } - -const loading = (loading) => ({ - type: prefix + 'LOADING', - payload: { loading }, -}) - -const loadingSearch = (loadingSearch) => ({ - type: prefix + 'LOADING_SEARCH', - payload: { loadingSearch }, -}) - -// 検索と全体読み込みのエントリーは別 -export const getScoreListAll = () => { - return async (dispatch) => { - dispatch(loading(true)) - dispatch(getScoreList('')) - } -} - -export const changeSearchText = (searchQuery) => { - return async (dispatch) => { - dispatch(loadingSearch(true)) - dispatch(getScoreList(searchQuery)) - dispatch(loadMoreLoading(false)) - dispatch(setSearchQuery(searchQuery)) - } -} - -const setSearchQuery = (searchQuery) => ({ - type: prefix + 'SET_SEARCH_QUERY', - payload: { searchQuery }, -}) - -export const resetSearchQuery = () => { - return async (dispatch, getState) => { - dispatch(changeSearchText('')) - getState().score.searchBoxRef.focus() - } -} - -export const getScoreList = (query) => { - return async (dispatch) => { - if (!window.localStorage.token) return false - const requestTime = String(new Date().getTime()) - !window.localStorage.scoreLoadList ? window.localStorage.setItem('scoreLoadList', requestTime) : false - if (requestTime > window.localStorage.scoreLoadList) window.localStorage.setItem('scoreLoadList', requestTime) - const path = lib.getScorePath() + '/api/member/score' - const send = { - session: lib.getSession(), - query: query === undefined ? '' : query, - } - request.post(path, send, (err, res) => { - if (err) { - return false - } else { - if (res.body.status && window.localStorage.scoreLoadList === requestTime) { - const list = res.body.list.filter((s) => s.scoreStatus !== '-1') - dispatch(setScoreList(list)) - dispatch(showListUpdate(list.slice(0, 10))) - } - } - dispatch(loading(false)) - dispatch(loadingSearch(false)) - }) - } -} - -const setScoreList = (scoreList) => ({ - type: prefix + 'SET_SCORE_LIST', - payload: { scoreList }, -}) - -export const loadMore = () => { - return async (dispatch, getState) => { - dispatch(loadMoreLoading(true)) - const showList = getState().score.showList.concat(getState().score.scoreList.slice(10)) - dispatch(showListUpdate(showList)) - } -} - -export const resetShowList = () => { - return async (dispatch) => { - dispatch(loadMoreLoading(false)) - dispatch(showListUpdate([])) - } -} - -const loadMoreLoading = (loadMoreLoading) => ({ - type: prefix + 'LOAD_MORE_LOADING', - payload: { loadMoreLoading }, -}) - -const showListUpdate = (showList) => ({ - type: prefix + 'SHOW_LIST_UPDATE', - payload: { showList }, -}) - -export const setSearchBoxRef = (searchBoxRef) => ({ - type: prefix + 'SET_SEARCH_BOX_REF', - payload: { searchBoxRef }, -}) - -export const setDisplayScoreModal = (displayScoreModal, modalContent) => ({ - type: prefix + 'SET_DISPLAY_SCORE_MODAL', - payload: { displayScoreModal, modalContent }, -}) - -// detail, edit 共用 -const detailLoading = (detailLoading) => ({ - type: prefix + 'DETAIL_LOADING', - payload: { detailLoading }, -}) - -export const getScoreDetail = (scoreid) => { - return async (dispatch) => { - if (!window.localStorage.token) return false - dispatch(detailLoading(true)) - const path = lib.getScorePath() + '/api/member/detail' - const send = { - session: lib.getSession(), - id: scoreid, - } - request.post(path, send, (err, res) => { - if (err) { - return false - } else if (res.body.status) { - // boxUseは使用中の箱情報が入る - let boxList = [], - boxUse - for (let i = 0; i < res.body.boxList.length; i++) { - if (res.body.boxList[i].status) boxList.push(res.body.boxList[i]) - if (res.body.data.boxLabel === res.body.boxList[i].label) boxUse = res.body.boxList[i] - } - dispatch(setScoreDetail(scoreid, res.body.data, boxUse)) - dispatch(setBoxList(boxList)) - } - dispatch(detailLoading(false)) - }) - } -} - -const setScoreDetail = (scoreid, scoreDetail, boxUse) => ({ - type: prefix + 'SET_SCORE_DETAIL', - payload: { scoreid, scoreDetail, boxUse }, -}) - -const setBoxList = (boxList) => ({ - type: prefix + 'SET_BOX_LIST', - payload: { boxList }, -}) - -// score edit -export const setEditModalRef = (editModalRef) => ({ - type: prefix + 'SET_EDIT_MODAL_REF', - payload: { editModalRef }, -}) - -export const setDisplayEditScoreModal = (displayEditScoreModal, editMode, scoreEdit) => { - return async (dispatch, getState) => { - if (getState().score.editModalRef) getState().score.editModalRef.scrollTop = 0 - // 開くときは loadScoreEdit の最後に dispatch する - displayEditScoreModal ? false : dispatch(updateDisplayEditScoreModal(displayEditScoreModal)) - displayEditScoreModal ? dispatch(loadScoreEdit(editMode)) : false - dispatch(setEditMode(editMode)) - dispatch(setScoreEdit(scoreEdit)) - } -} - -const editPreLoading = (editPreLoading) => ({ - type: prefix + 'EDIT_PRE_LOADING', - payload: { editPreLoading }, -}) - -const loadScoreEdit = (editMode) => { - return async (dispatch, getState) => { - if (!window.localStorage.token) return false - dispatch(editPreLoading(true)) - // URL - const path = lib.getScorePath() + '/api/member/edit/pre' - const send = { - session: lib.getSession(), - mode: editMode, - id: editMode !== 'new' ? getState().score.scoreid : false, - } - request.post(path, send, (err, res) => { - if (err) { - return false - } else if (res.body.status) { - // 箱が未作成のときはBoxManagementComponentへ - if (res.body.boxList.length === 0) return // 確認 これはエラー処理する this.redirectBoxManagement() - let boxList = [] - for (let i = 0; i < res.body.boxList.length; i++) { - if (res.body.boxList[i].status) boxList.push(res.body.boxList[i]) - } - // 使用可能な箱がない - if (boxList.length === 0) return // 確認 これはエラー処理する this.redirectBoxManagement() - if (editMode === 'new') { - // 新規作成 - // Object.assign はシャローコピーなので使わない - // let newScore = Object.assign({}, newScoreObject) - let newScore = JSON.parse(JSON.stringify(newScoreObject)) - newScore['boxLabel'] = boxList[boxList.length - 1].label - // 楽譜番号と楽譜管理番号 - if (!res.body.latest) { - // 今まで楽譜登録なし - dispatch(setScoreEdit(newScore)) - dispatch(setBoxList(boxList)) - } else { - newScore['number'] = parseInt(res.body.latest.number) + 1 - newScore['label'] = ('000000' + newScore.number).slice(-6) - // 新しい楽譜オブジェクトのプロパティで配列の値は - dispatch(setScoreEdit(newScore)) - dispatch(setBoxList(boxList)) - } - } else { - // 編集 - // dispatch(setScoreEdit(res.body.data)) これはDetailと同じだと思うけど確認する - dispatch(setBoxList(boxList)) - } - } - dispatch(updateDisplayEditScoreModal(true)) - // Modal が開くのを待つ - setTimeout(() => { - dispatch(editPreLoading(false)) - }, 100) - }) - } -} - -const updateDisplayEditScoreModal = (displayEditScoreModal) => ({ - type: prefix + 'UPDATE_DISPLAY_EDIT_SCORE_MODAL', - payload: { displayEditScoreModal }, -}) - -const setEditMode = (editMode) => ({ - type: prefix + 'SET_EDIT_MODE', - payload: { editMode }, -}) - -export const setScoreEdit = (scoreEdit) => ({ - type: prefix + 'SET_SCORE_EDIT', - payload: { scoreEdit }, -}) - -const editLoading = (editLoading) => ({ - type: prefix + 'EDIT_LOADING', - payload: { editLoading }, -}) - -export const updateScoreEdit = () => { - return async (dispatch, getState) => { - if (!window.localStorage.token) return false - dispatch(editLoading(true)) - // URL - const path = lib.getScorePath() + '/api/member/edit' - const send = { - session: lib.getSession(), - mode: getState().score.editMode, - id: getState().score.scoreid, - data: getState().score.scoreEdit, - } - request.post(path, send, (err, res) => { - if (err) { - return false - } else if (res.body.status) { - if (getState().score.editMode !== 'new') { - dispatch(getScoreDetail(getState().score.scoreid)) - dispatch(showToast('楽譜情報を修正しました')) - } else { - dispatch(getScoreListAll()) - // 新規追加前に検索文字列指定してたときは解除 - dispatch(setSearchQuery('')) - dispatch(showToast('新しい楽譜を追加しました')) - } - dispatch(setDisplayEditScoreModal(false, undefined, undefined)) - // mobileの場合はスクロールする - if (getState().status.mobile) dispatch(scrollToTop()) - } - dispatch(editLoading(false)) - }) - } -} diff --git a/client/src/Actions/ScoreBox.js b/client/src/Actions/ScoreBox.js deleted file mode 100644 index 62674ef7..00000000 --- a/client/src/Actions/ScoreBox.js +++ /dev/null @@ -1,116 +0,0 @@ -import * as request from '../Library/Request' -import * as lib from '../Library/Library' - -const prefix = 'SCOREBOX_' - -// const loading = (loading) => ({ -// type: prefix + 'LOADING', -// payload: { loading } -// }) - -export const getBoxList = () => { - return async (dispatch, getState) => { - if (!window.localStorage.token) return false - if (getState().scoreBox.acquired) return false - // dispatch(loading(true)) - const path = lib.getScorePath() + '/api/member/box' - const send = { - session: lib.getSession(), - } - request.post(path, send, (err, res) => { - if (err) { - return false - } else { - if (res.body.status) { - dispatch(setBoxList(res.body.list)) - dispatch(acquired(true)) - } - } - // dispatch(loading(false)) - }) - } -} - -const setBoxList = (boxList) => ({ - type: prefix + 'SET_BOX_LIST', - payload: { boxList }, -}) - -export const setDisplayBoxModal = (displayBoxModal, modalContent) => { - const inputBoxLocate = !modalContent.locate ? '' : modalContent.locate - return { - type: prefix + 'SET_DISPLAY_BOX_MODAL', - payload: { displayBoxModal, modalContent, inputBoxLocate }, - } -} - -const acquired = (acquired) => ({ - type: prefix + 'ACQUIRED', - payload: { acquired }, -}) - -export const changeInputBoxLocate = (inputBoxLocate) => ({ - type: prefix + 'CHANGE_INPUT_BOX_LOCATE', - payload: { inputBoxLocate }, -}) - -const loadingUpdateBoxLocate = (loadingUpdateBoxLocate) => ({ - type: prefix + 'LOADING_UPDATE_BOX_LOCATE', - payload: { loadingUpdateBoxLocate }, -}) - -export const updateBoxLocate = () => { - return async (dispatch, getState) => { - if (!window.localStorage.token) return false - dispatch(loadingUpdateBoxLocate(true)) - const path = lib.getScorePath() + '/api/member/box/modify' - const send = { - session: lib.getSession(), - id: getState().scoreBox.modalContent._id, - locate: getState().scoreBox.inputBoxLocate, - } - request.post(path, send, (err, res) => { - if (err) { - return false - } else { - if (res.body.status) { - const boxList = JSON.parse(JSON.stringify(getState().scoreBox.boxList)) - boxList[getState().scoreBox.boxList.findIndex((item) => item === getState().scoreBox.modalContent)].locate = - '読み込み中' - dispatch(setBoxList(boxList)) - dispatch(acquired(false)) - dispatch(setDisplayBoxModal(false, getState().scoreBox.modalContent)) - dispatch(getBoxList()) - } - } - dispatch(loadingUpdateBoxLocate(false)) - }) - } -} - -const loadingAddBox = (loadingAddBox) => ({ - type: prefix + 'LOADING_ADD_BOX', - payload: { loadingAddBox }, -}) - -export const addBox = () => { - return async (dispatch) => { - if (!window.localStorage.token) return false - dispatch(loadingAddBox(true)) - const path = lib.getScorePath() + '/api/member/box/add' - const send = { - session: lib.getSession(), - } - request.post(path, send, (err, res) => { - if (err) { - return false - } else { - if (res.body.status) { - dispatch(acquired(false)) - dispatch(getBoxList()) - } - } - dispatch(loadingAddBox(false)) - }) - } -} diff --git a/client/src/Actions/Setting.js b/client/src/Actions/Setting.js deleted file mode 100644 index e30e3fef..00000000 --- a/client/src/Actions/Setting.js +++ /dev/null @@ -1,352 +0,0 @@ -import * as request from '../Library/Request' -import { replace } from 'react-router-redux' -import * as lib from '../Library/Library' -import { showToast } from './Toast' - -import { setUser, logout } from './Status' - -// import { listen } from 'react-router-redux' -const prefix = 'SETTING_' - -const loading = (loading) => ({ - type: prefix + 'LOADING', - payload: { loading }, -}) - -// 確認 ここにUserdataの読み込み書けばよいのでは -export const getUser = () => { - return async (dispatch) => { - if (!window.localStorage.token) return false - dispatch(loading(true)) - const path = lib.getAuthPath() + '/auth' - const send = { - session: lib.getSession(), - } - request.post(path, send, (err, res) => { - if (err) { - return false - } else { - if (res.body.status) { - dispatch(setUser(res.body.user)) - } - } - dispatch(loading(false)) - }) - } -} - -export const setModifyText = (modifyText) => ({ - type: prefix + 'SET_MODIFY_TEXT', - payload: { modifyText }, -}) - -const loadingModify = (loadingModify) => ({ - type: prefix + 'LOADING_MODIFY', - payload: { loadingModify }, -}) - -export const updateModifyText = (apiPath, replacePath) => { - return async (dispatch, getState) => { - if (!window.localStorage.token) return false - dispatch(loadingModify(true)) - const send = { - session: lib.getSession(), - text: getState().setting.modifyText, - } - request.post(apiPath, send, (err, res) => { - if (err) { - return false - } else { - if (res.body.status) { - dispatch(replace(replacePath)) - dispatch(showToast('変更しました')) - } else { - dispatch(showToast('入力した内容を確認してください')) - } - } - dispatch(loadingModify(false)) - }) - } -} - -const loadingDeleteEmailRequest = (loadingDeleteEmailRequest) => ({ - type: prefix + 'LOADING_DELETE_EMAIL_REQUEST', - payload: { loadingDeleteEmailRequest }, -}) - -export const deleteEmailRequest = () => { - return async (dispatch) => { - if (!window.localStorage.token) return false - dispatch(loadingDeleteEmailRequest(true)) - const path = lib.getAuthPath() + '/api/setting/email' - const send = { - session: lib.getSession(), - // ここで空にする(この値が保存される) - text: '', - delMail: true, - } - request.post(path, send, (err, res) => { - if (err) { - return false - } else { - if (res.body.status) { - dispatch(replace('/setting')) - dispatch(showToast('メールアドレスを削除しました')) - } - } - dispatch(loadingDeleteEmailRequest(false)) - }) - } -} - -// Password -export const setOldPassword = (oldPassword) => ({ - type: prefix + 'SET_OLD_PASSWORD', - payload: { oldPassword }, -}) - -export const setNewPassword = (newPassword) => ({ - type: prefix + 'SET_NEW_PASSWORD', - payload: { newPassword }, -}) - -const loadingUpdatePassword = (loadingUpdatePassword) => ({ - type: prefix + 'LOADING_UPDATE_PASSWORD', - payload: { loadingUpdatePassword }, -}) - -export const updatePassword = () => { - return async (dispatch, getState) => { - if (!window.localStorage.token) return false - dispatch(loadingUpdatePassword(true)) - const path = lib.getAuthPath() + '/api/setting/password' - const send = { - session: lib.getSession(), - old: getState().setting.oldPassword, - new: getState().setting.newPassword, - } - request.post(path, send, (err, res) => { - if (err) { - return false - } else { - if (res.body.status) { - dispatch(replace('/setting')) - dispatch(showToast('パスワードを変更しました')) - } else { - dispatch(showToast('古いパスワードを確認してください')) - } - dispatch(setOldPassword('')) - dispatch(setNewPassword('')) - } - dispatch(loadingUpdatePassword(false)) - }) - } -} - -// Session Management -export const requestDeleteSession = (clientid) => { - return (dispatch) => { - dispatch(loading('update')) - const path = lib.getAuthPath() + '/api/setting/deletesession' - const send = { - session: lib.getSession(), - clientid, - } - request.post(path, send, (err, res) => { - if (err) { - return dispatch(showToast('ネットワークエラーです')) - } else { - if (res.body.status) { - dispatch(showToast('セッションを削除しました')) - dispatch(getUser()) - } else { - dispatch(showToast('削除できませんでした')) - } - } - dispatch(loading(false)) - }) - } -} - -// Administrator -export const setAdminRequestPass = (adminRequestPass) => ({ - type: prefix + 'SET_ADMIN_REQUEST_PASS', - payload: { adminRequestPass }, -}) - -const loadingAdminRequest = (loadingAdminRequest) => ({ - type: prefix + 'LOADING_ADMIN_REQUEST', - payload: { loadingAdminRequest }, -}) - -export const sendAdminRequest = () => { - return async (dispatch, getState) => { - if (!window.localStorage.token) return false - dispatch(loadingAdminRequest(true)) - const adminRequest = 'admin' in getState().status.user ? !getState().status.user.admin : true - const path = lib.getAuthPath() + '/api/setting/admin' - const send = { - session: lib.getSession(), - admin: adminRequest, - pass: getState().setting.adminRequestPass, - } - request.post(path, send, (err, res) => { - if (err) { - return false - } else { - if (res.body.status) { - if (!res.body.error) { - dispatch(replace('/setting')) - res.body.admin ? dispatch(showToast('管理者になりました')) : dispatch(showToast('管理者を辞めました')) - } else { - dispatch(showToast('管理者パスワードが違います')) - } - } - } - dispatch(setAdminRequestPass('')) - dispatch(loadingAdminRequest(false)) - }) - } -} - -// Delete Account -export const setDeletePassword = (deletePassword) => ({ - type: prefix + 'SET_DELETE_PASSWORD', - payload: { deletePassword }, -}) - -const loadingDeleteAccount = (loadingDeleteAccount) => ({ - type: prefix + 'LOADING_DELETE_ACCOUNT', - payload: { loadingDeleteAccount }, -}) - -export const sendDeleteRequest = () => { - return async (dispatch, getState) => { - if (!window.localStorage.token) return false - dispatch(loadingDeleteAccount(true)) - const path = lib.getAuthPath() + '/api/setting/delete' - const send = { - session: lib.getSession(), - pass: getState().setting.deletePassword, - } - request.post(path, send, (err, res) => { - if (err) { - return false - } else { - if (res.body.status) { - // dispatch(replace('/setting')) - // ここでログアウト処理 - dispatch(logout()) - } else { - dispatch(showToast('パスワードを確認してください')) - } - dispatch(setDeletePassword('')) - } - dispatch(loadingDeleteAccount(false)) - }) - } -} - -// Score Setting -export const setScoreAdminRequestPass = (scoreAdminRequestPass) => ({ - type: prefix + 'SET_SCORE_ADMIN_REQUEST_PASS', - payload: { scoreAdminRequestPass }, -}) - -const loadingScoreAdminRequest = (loadingScoreAdminRequest) => ({ - type: prefix + 'LOADING_SCORE_ADMIN_REQUEST', - payload: { loadingScoreAdminRequest }, -}) - -export const sendScoreAdminRequest = () => { - return async (dispatch, getState) => { - if (!window.localStorage.token) return false - dispatch(loadingScoreAdminRequest(true)) - const adminRequest = 'scoreAdmin' in getState().status.user ? !getState().status.user.scoreAdmin : true - // if (!adminRequest && getState().setting.scoreAdminRequestPass === '') return false - const path = lib.getAuthPath() + '/api/setting/score/admin' - const send = { - session: lib.getSession(), - admin: adminRequest, - pass: getState().setting.scoreAdminRequestPass, - } - request.post(path, send, (err, res) => { - if (err) { - return false - } else { - if (res.body.status) { - if (!res.body.error) { - dispatch(replace('/setting')) - res.body.admin - ? dispatch(showToast('楽譜管理者になりました')) - : dispatch(showToast('楽譜管理者を辞めました')) - } else { - dispatch(showToast('管理者パスワードが違います')) - } - } - } - dispatch(setScoreAdminRequestPass('')) - dispatch(loadingScoreAdminRequest(false)) - }) - } -} - -const loadingScoreCount = (loadingScoreCount) => ({ - type: prefix + 'LOADING_SCORE_COUNT', - payload: { loadingScoreCount }, -}) - -export const getScoreCount = () => { - return async (dispatch) => { - if (!window.localStorage.token) return false - dispatch(loadingScoreCount(true)) - const path = lib.getScorePath() + '/api/member/count' - const send = { - session: lib.getSession(), - } - request.post(path, send, (err, res) => { - if (err) { - return false - } else { - if (res.body.status) { - dispatch(setScoreCount(res.body.count)) - } - } - dispatch(loadingScoreCount(false)) - }) - } -} - -const setScoreCount = (scoreCount) => ({ - type: prefix + 'SET_SCORE_COUNT', - payload: { scoreCount }, -}) - -const loadingScoreMailRequest = (loadingScoreMailRequest) => ({ - type: prefix + 'LOADING_SCORE_MAIL_REQUEST', - payload: { loadingScoreMailRequest }, -}) - -export const scoreMailRequest = () => { - return async (dispatch, getState) => { - if (!window.localStorage.token) return false - dispatch(loadingScoreMailRequest(true)) - const email = 'email' in getState().status.user ? getState().status.user.email : false - if (!email) return false - const path = lib.getScorePath() + '/api/member/sendmail' - const send = { - session: lib.getSession(), - } - request.post(path, send, (err, res) => { - if (err) { - return false - } else { - if (res.body.status) { - // if (!res.body.error) dispatch(replace('/setting')) - dispatch(showToast('メールを送信しました')) - } - } - dispatch(loadingScoreMailRequest(false)) - }) - } -} diff --git a/client/src/Actions/Source.js b/client/src/Actions/Source.js deleted file mode 100644 index 3f537f46..00000000 --- a/client/src/Actions/Source.js +++ /dev/null @@ -1,40 +0,0 @@ -import * as request from '../Library/Request' -import * as lib from '../Library/Library' - -const prefix = 'SOURCE_' - -const loading = (loading) => ({ - type: prefix + 'LOADING', - payload: { loading }, -}) - -export const getSource = () => { - return async (dispatch, getState) => { - if (!window.localStorage.token) return false - if (getState().source.acquired) return false - dispatch(loading(true)) - const path = lib.getAppPath() + '/api/source' - const send = { - session: lib.getSession(), - } - request.post(path, send, (err, res) => { - if (err) { - return false - } else { - dispatch(setList(res.body.list)) - dispatch(acquired(true)) - } - dispatch(loading(false)) - }) - } -} - -const setList = (list) => ({ - type: prefix + 'SET_LIST', - payload: { list }, -}) - -const acquired = (acquired) => ({ - type: prefix + 'ACQUIRED', - payload: { acquired }, -}) diff --git a/client/src/Actions/Status.js b/client/src/Actions/Status.js deleted file mode 100644 index e40f12d2..00000000 --- a/client/src/Actions/Status.js +++ /dev/null @@ -1,158 +0,0 @@ -import { replace } from 'react-router-redux' - -import { navigationMenu } from './Navigation' -import * as request from '../Library/Request' -import * as lib from '../Library/Library' - -import { showToast } from './Toast' - -// import { listen } from 'react-router-redux' -const prefix = 'STATUS_' - -export const loginAuth = (location) => { - return async (dispatch, getState) => { - if (!window.localStorage.token) return dispatch(loginUpdate(false)) - if (getState().status.loading) return false - dispatch(loading(true)) - const path = lib.getAuthPath() + '/auth' - const send = { - session: lib.getSession(), - } - request.post(path, send, (err, res) => { - if (err) { - dispatch(showToast('ログインエラー')) - dispatch(replace('/login')) - return false - } else { - if (res.body.status) { - dispatch(windsidUpdate(window.localStorage.windsid)) - dispatch(tokenUpdate(res.body.token)) - dispatch(loginUpdate(true)) - dispatch(setUser(res.body.user)) - // location ? dispatch(replace(location)) : dispatch(replace('/')) - location ? dispatch(replace(location)) : false - } else { - lib.removeLocalStorage() - dispatch(windsidUpdate(false)) - dispatch(tokenUpdate(false)) - dispatch(loginUpdate(false)) - dispatch(showToast('ログインしてください')) - } - } - dispatch(loading(false)) - }) - } -} - -export const logout = () => { - return async (dispatch, getState) => { - if (getState().status.loading) return false - dispatch(loading(true)) - const path = lib.getAuthPath() + '/logout' - const send = { - session: lib.getSession(), - } - request.post(path, send, (err) => { - if (err) { - dispatch(showToast('ネットワークエラー')) - dispatch(replace('/login')) - return false - } else { - lib.removeLocalStorage() - dispatch(showToast('ログアウトしました')) - dispatch(windsidUpdate(false)) - dispatch(tokenUpdate(false)) - dispatch(loginUpdate(false)) - } - dispatch(loading(false)) - }) - } -} - -export const loginUpdate = (login) => ({ - type: prefix + 'LOGIN', - payload: { login }, -}) - -export const setUser = (user) => ({ - type: prefix + 'SET_USER', - payload: { user }, -}) - -export const windsidUpdate = (windsid) => { - windsid ? window.localStorage.setItem('windsid', windsid) : false - return { - type: prefix + 'WINDSID', - payload: { windsid }, - } -} - -export const tokenUpdate = (token) => { - token ? window.localStorage.setItem('token', token) : false - return { - type: prefix + 'TOKEN', - payload: { token }, - } -} - -export const loading = (loading) => ({ - type: prefix + 'LOADING', - payload: { loading }, -}) - -// export const windowWidthChange = () => { -// const width = window.innerWidth -// const pc = width > 920 ? true : false -// const mobile = !pc -// return { -// type: prefix + 'WINDOW_WIDTH', -// payload: { -// width, -// pc, -// mobile -// } -// } -// } - -export const windowWidthChange = () => { - return (dispatch) => { - const width = window.innerWidth - const pc = width > 920 ? true : false - const mobile = !pc - dispatch(setWidth(width, pc, mobile)) - if (pc) dispatch(navigationMenu(false)) - // return { - // type: prefix + 'WINDOW_WIDTH', - // payload: { - // width, - // pc, - // mobile - // } - // } - } -} - -export const setWidth = (width, pc, mobile) => ({ - type: prefix + 'WINDOW_WIDTH', - payload: { width, pc, mobile }, -}) - -export const scrollToTop = () => { - return (dispatch, getState) => { - if (getState().status.contentsRef) { - getState().status.contentsRef.scrollTop = 0 - } - } -} - -export const scrollToTopSmooth = () => { - return (dispatch, getState) => { - if (getState().status.contentsRef) { - getState().status.contentsRef.scroll({ - top: 0, - left: 0, - behavior: 'smooth', - }) - } - } -} diff --git a/client/src/Actions/Toast.js b/client/src/Actions/Toast.js deleted file mode 100644 index c0fa529d..00000000 --- a/client/src/Actions/Toast.js +++ /dev/null @@ -1,44 +0,0 @@ -export const showToast = (string) => { - return async (dispatch, getState) => { - if (getState().toast.status) return false - const timeout = 3600 - dispatch(display(string)) - setTimeout(() => { - dispatch(hide(true)) - }, timeout - 600) - setTimeout(() => { - dispatch(end()) - }, timeout) - } -} - -export const display = (string) => { - return { - type: 'TOAST_DISPLAY', - payload: { - string, - status: true, - hide: false, - end: false, - }, - } -} - -export const hide = () => ({ - type: 'TOAST_HIDE', - payload: { - status: true, - hide: true, - end: false, - }, -}) - -export const end = () => ({ - type: 'TOAST_END', - payload: { - string: '', - status: false, - hide: true, - end: true, - }, -}) diff --git a/client/src/Actions/Tutorial.js b/client/src/Actions/Tutorial.js deleted file mode 100644 index d91f004d..00000000 --- a/client/src/Actions/Tutorial.js +++ /dev/null @@ -1,50 +0,0 @@ -import { audioPause } from './Audio' - -const prefix = 'TUTORIAL_' - -export const openFirstTutorial = () => { - return async (dispatch) => { - dispatch(setStandalone()) - dispatch(setUserAgent()) - dispatch(setDisplayTutorial(true, 'first')) - // 音楽再生中の場合は一時停止する - dispatch(audioPause()) - } -} - -export const requestFirstTutorial = () => { - return async (dispatch) => { - dispatch(setStandalone()) - dispatch(setUserAgent()) - if (!window.matchMedia('(display-mode: standalone)').matches && getUserAgent() !== 'other') { - dispatch(setDisplayTutorial(true, 'first')) - } - // 音楽再生中の場合は一時停止する - dispatch(audioPause()) - } -} - -const setUserAgent = () => ({ - type: prefix + 'SET_USER_AGENT', - payload: { userAgent: getUserAgent() }, -}) - -function getUserAgent() { - let ua = ['iPod', 'iPad', 'iPhone', 'Android'] - let result = false - for (let i = 0; i < ua.length; i++) { - if (navigator.userAgent.indexOf(ua[i]) > 0) result = ua[i] - } - return result ? result : 'other' -} - -const setStandalone = () => ({ - type: prefix + 'SET_STANDALONE', - payload: { standalone: window.matchMedia('(display-mode: standalone)').matches ? true : false }, -}) - -// 閉じるときに使う -export const setDisplayTutorial = (displayTutorial, tutorialMode) => ({ - type: prefix + 'SET_DISPLAY_TUTORIAL', - payload: { displayTutorial, tutorialMode }, -}) diff --git a/client/src/App.js b/client/src/App.js deleted file mode 100644 index a4610e3d..00000000 --- a/client/src/App.js +++ /dev/null @@ -1,49 +0,0 @@ -import React, { Component } from 'react' -import { Route, Switch } from 'react-router-dom' -import { Provider } from 'react-redux' -import { ConnectedRouter } from 'react-router-redux' -// import createBrowserHistory from 'history/createBrowserHistory' -import { createBrowserHistory } from 'history' - -import createStore from './Store/Store' - -import Base from './Component/Base/Base' -import Auth from './Component/Auth/Auth' - -import Toast from './Component/Toast/Toast' - -import * as request from './Library/Request' -import * as lib from './Library/Library' - -const history = createBrowserHistory() -const store = createStore(history) - -// react-router-redux の Action をフック -// リンク移動先を保存 -history.listen((location) => { - window.localStorage.setItem('location', location.pathname) - request.sendPath({ - session: lib.getSession(), - path: location.pathname, - }) -}) - -export default class App extends Component { - render() { - return ( - - - - - - - - - - - - - - ) - } -} diff --git a/client/src/Asset/Logo/logo_mobile.svg b/client/src/Asset/Logo/logo_mobile.svg deleted file mode 100644 index c3c68efd..00000000 --- a/client/src/Asset/Logo/logo_mobile.svg +++ /dev/null @@ -1,144 +0,0 @@ - diff --git a/client/src/Asset/back.svg b/client/src/Asset/back.svg deleted file mode 100644 index 7801a385..00000000 --- a/client/src/Asset/back.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/client/src/Asset/logo.svg b/client/src/Asset/logo.svg deleted file mode 100644 index 5e7322c5..00000000 --- a/client/src/Asset/logo.svg +++ /dev/null @@ -1,142 +0,0 @@ - diff --git a/client/src/Component/Auth/Archive/Archive.js b/client/src/Component/Auth/Archive/Archive.js deleted file mode 100644 index 9e91e17b..00000000 --- a/client/src/Component/Auth/Archive/Archive.js +++ /dev/null @@ -1,57 +0,0 @@ -import React, { Component } from 'react' -import { Route, Switch, Link } from 'react-router-dom' - -import { connect } from 'react-redux' - -import Back from '../../../Library/Icons/Back' -import * as lib from '../../../Library/Library' - -import Home from './Home/Home' -import Overview from './Overview/Overview' -import Photo from './Photo/Photo' -import Video from './Video/Video' - -import './Archive.css' - -function mapStateToProps(state) { - return { - pc: state.status.pc, - } -} - -function mapDispatchToProps() { - return {} -} - -class Archive extends Component { - render() { - return ( -
- - - - - - - - -
-
-
    -
  • - -
    - - ホーム -
    - -
  • -
-
-
-
- ) - } -} - -export default connect(mapStateToProps, mapDispatchToProps)(Archive) diff --git a/client/src/Component/Auth/Archive/Archive.scss b/client/src/Component/Auth/Archive/Archive.scss deleted file mode 100644 index a727da89..00000000 --- a/client/src/Component/Auth/Archive/Archive.scss +++ /dev/null @@ -1,42 +0,0 @@ -.archive { - width: 100%; - // max-width: 600px; - margin: 0 auto; - // font-size: 13px; - - // &.mobile { - // margin: 12px 0; - // } - - // background: #fff; - - // &.pc { - // .contents-header { - // h2 { - // padding: 0 16px; - // } - - // p { - // padding: 0 16px; - // } - // } - // } - - // .contents-header { - // margin: 0; - // padding: 16px 0; - // background: #fff; - - // h2 { - // padding: 0 12px; - // font-size: 1.2rem; - // font-weight: normal; - // } - - // p { - // margin: 4px 0; - // padding: 0 12px; - // font-size: .9rem; - // } - // } -} diff --git a/client/src/Component/Auth/Archive/Home/Home.js b/client/src/Component/Auth/Archive/Home/Home.js deleted file mode 100644 index 9c11e526..00000000 --- a/client/src/Component/Auth/Archive/Home/Home.js +++ /dev/null @@ -1,323 +0,0 @@ -import React, { Component } from 'react' -import { Link } from 'react-router-dom' - -import { connect } from 'react-redux' - -import { setNavigationTitle, setBackNavigation } from '../../../../Actions/Navigation' -import { - getConcertList, - toggleDisplayMain, - toggleDisplayMini, - toggleDisplayOther, - setSearchRef, - search, - resetSearch, -} from '../../../../Actions/Archive' -import { archivePlayRequest } from '../../../../Actions/Audio' - -import * as lib from '../../../../Library/Library' - -import './Home.css' - -function mapStateToProps(state) { - return { - pc: state.status.pc, - loadingArchive: state.archive.loading, - concertList: state.archive.concertList, - displayMain: state.archive.displayMain, - displayMini: state.archive.displayMini, - displayOther: state.archive.displayOther, - - loadingSearch: state.archive.loadingSearch, - searchRef: state.archive.searchRef, - searchQuery: state.archive.searchQuery, - searchResult: state.archive.searchResult, - } -} - -function mapDispatchToProps(dispatch) { - return { - setNavigationTitle(title) { - dispatch(setNavigationTitle(title)) - }, - setBackNavigation(backNavigation, backNavigationPath) { - dispatch(setBackNavigation(backNavigation, backNavigationPath)) - }, - getConcertList() { - dispatch(getConcertList()) - }, - toggleDisplayMain(display) { - dispatch(toggleDisplayMain(display)) - }, - toggleDisplayMini(display) { - dispatch(toggleDisplayMini(display)) - }, - toggleDisplayOther(display) { - dispatch(toggleDisplayOther(display)) - }, - setSearchRef(searchRef) { - dispatch(setSearchRef(searchRef)) - }, - search(value) { - dispatch(search(value)) - }, - resetSearch() { - dispatch(resetSearch()) - }, - archivePlayRequest(id, number, playRequest) { - dispatch(archivePlayRequest(id, number, playRequest)) - }, - } -} - -class Home extends Component { - componentDidMount() { - this.props.setNavigationTitle('アーカイブ') - this.props.setBackNavigation(true, '/') - this.props.getConcertList() - } - - componentWillUnmount() { - this.props.resetSearch() - } - - renderSearch() { - const searchIcon = this.props.loadingSearch ? ( - - ) : ( - - ) - const searchBarButtonClass = this.props.searchQuery ? 'search-bar-button' : 'search-bar-button hidden' - const searchModeClass = this.props.searchQuery ? ' search-mode' : '' - return ( -
-
-
-
{searchIcon}
- this.props.search(e.target.value)} - ref={(i) => { - !this.props.searchRef ? this.props.setSearchRef(i) : false - }} - placeholder="検索" - /> -
this.props.resetSearch()} className={searchBarButtonClass}> - -
-
-
-
- ) - } - - renderSearchResult() { - if (!this.props.searchResult) return - const searchResult = this.props.searchResult.map((item, i) => { - if (!item) return //
- return item.map((each, j) => { - if (!each) return //
- // const concertType = ' ' + each.concert.type - // const composer = each.track.composer ? each.track.composer : '' - const composer = each.track.composer ? ( - each.track.arranger ? ( - - {each.track.composer} - {each.track.composer.match(/民謡/) ? '' : '作曲'} - / - {each.track.arranger}編曲 - - ) : ( - {each.track.composer} - ) - ) : each.track.arranger ? ( - {each.track.arranger}編曲 - ) : ( - '' - ) - const audioHandler = !isNaN(each.track.audio) - ? () => { - this.props.archivePlayRequest(each.concert.id, each.track.audio, true) - } - : () => {} - // const videoHandler = !isNaN(each.track.video) ? () => {this.openVideo(each.concert.id, each.track.video)} : () => {} - const videoLinkTo = !isNaN(each.track.video) - ? '/archive/video/' + each.concert.id + '/' + each.track.video - : false - const audioIcon = !isNaN(each.track.audio) ? ( - - ) : ( - - ) - const videoIcon = !isNaN(each.track.video) ? ( - - - - ) : ( - - ) - return ( -
-
- {each.concert.title} - {each.track.title} - {composer} -
-
- - {audioIcon} - - - {videoIcon} - -
-
- ) - }) - }) - return
{searchResult}
- } - - renderConcertSwitch(loadingArchive, concertList) { - if (loadingArchive || !concertList) return false - if (this.props.searchQuery) return false - return ( -
-
this.props.toggleDisplayMain(!this.props.displayMain)} - > - 定期演奏会 -
-
this.props.toggleDisplayMini(!this.props.displayMini)} - > - ミニコンサート -
-
this.props.toggleDisplayOther(!this.props.displayOther)} - > - その他 -
-
- ) - } - - renderConcertList(loadingArchive, concertList) { - if (loadingArchive || !concertList) - return ( -
-
-
-
-
- ) - if (this.props.searchResult) return - return concertList.map((each, i) => { - if (each.type === 'main' && !this.props.displayMain) return - if (each.type === 'mini' && !this.props.displayMini) return - if (each.type === 'other' && !this.props.displayOther) return - return ( - -
- {each.detail.title} - {each.detail.time.date} -
-
- -
- - ) - }) - } - - renderSearchNotice() { - if (!this.state.queryText && this.state.searchResult.length === 0) { - return ( -
- - 曲名、作編曲者 - 演奏会名で - 検索できます -
- ) - } else { - // if (this.state.queryText) { - // } - } - } - - renderNotice() { - if (this.props.searchQuery) { - var flag = false - this.props.searchResult.map((i) => { - i.map((e) => { - if (e) flag = true - }) - }) - if (flag) { - return ( -
- これ以上はありません -
- ) - } else { - return ( -
- みつかりませんでした -
- ) - } - } - if (!this.props.displayMain && !this.props.displayMini && !this.props.displayOther) { - return ( -
- - どれか選んでください -
- ) - } else { - return false - } - } - - render() { - // State List - const { loadingArchive, concertList } = this.props - - const showSearch = this.renderSearch() - const showSearchResult = this.renderSearchResult() - const showConcertSwitch = this.renderConcertSwitch(loadingArchive, concertList) - const showConcertList = this.renderConcertList(loadingArchive, concertList) - const showNotice = this.renderNotice() - - return ( - -
-
- ホーム - - アーカイブ -
-

アーカイブ

-

過去のウィンズの活動履歴を確認できます

-
-
- {showSearch} - {showSearchResult} - {showConcertSwitch} - {showConcertList} - {showNotice} -
-
- ) - } -} - -export default connect(mapStateToProps, mapDispatchToProps)(Home) diff --git a/client/src/Component/Auth/Archive/Library/Library.js b/client/src/Component/Auth/Archive/Library/Library.js deleted file mode 100644 index a38d0047..00000000 --- a/client/src/Component/Auth/Archive/Library/Library.js +++ /dev/null @@ -1,218 +0,0 @@ -import React from 'react' - -export function escapeReg(string) { - const reRegExp = /[\\^$.*+?()[\]{}|]/g - const reHasRegExp = new RegExp(reRegExp.source) - return string && reHasRegExp.test(string) ? string.replace(reRegExp, '\\$&') : string -} - -// function unixTimeFull (intTime) { -// var d = new Date(intTime) -// var year = d.getFullYear() -// var month = d.getMonth() + 1 -// var day = d.getDate() -// var hour = ('0' + d.getHours()).slice(-2) -// var min = ('0' + d.getMinutes()).slice(-2) -// // var sec = ('0' + d.getSeconds()).slice(-2) -// return (year + '/' + month + '/' + day + ' ' + hour + ':' + min) -// } - -// function getYear () { -// var d = new Date() -// var year = d.getFullYear() -// return (year) -// } - -// function unixDate (intTime) { -// var d = new Date(intTime) -// var year = d.getFullYear() -// var month = d.getMonth() + 1 -// var day = d.getDate() -// return (year + '/' + month + '/' + day) -// } - -// function unixTime (intTime) { -// var d = new Date(intTime) -// var hour = ('0' + d.getHours()).slice(-2) -// var min = ('0' + d.getMinutes()).slice(-2) -// return (hour + ':' + min); -// } - -// function makeLine (array) { -// var s = '' -// for (var i = 0; i { -// const s = '00' + v -// return s.substr(s.length - 2, 2) -// } -// if(h != 0){ -// hms = h + ':' + z2(m) + ':' + z2(s) -// }else if(m != 0){ -// hms = z2(m) + ':' + z2(s) -// }else{ -// hms = '00:' + z2(s) -// } -// return hms -// } - -function getConcertList(id, concertList) { - const concert = getConcert(id, concertList) - return concert.detail.data -} - -// function getAudioComposerText (id, num) { -// if (concertStore.list) { -// var list = getConcertList(id)[num] -// return list.composer ? list.composer : '' -// } -// } - -// function getAudioArrangerText (id, num) { -// if (concertStore.list) { -// var list = getConcertList(id)[num] -// return list.arranger ? list.arranger : '' -// } -// } - -// 演奏会のタイトルを取得する -export function getConcertTitle(id, concertList) { - return getConcert(id, concertList).detail.title -} - -export function getConcertType(id, concertList) { - return getConcert(id, concertList).type -} - -// function getConcertMusicLabel (id, num) { -// if (concertStore.list) { -// const concert = getConcert(id).detail -// // console.log(id, concert) -// return concert.contents.filter((e) => { -// // console.log(e.music.indexOf(num)) -// // console.log(num, e.music,e.music.indexOf(num)) -// if (e.music.indexOf(num) >= 0) return e -// })[0].label -// } -// } - -export function getConcert(id, concertList) { - return concertList.filter((e) => { - return e.id === id - })[0] -} - -// function listReverse (array, a) { -// var data = JSON.parse(JSON.stringify(array)) -// return a ? data.reverse() : data -// } - -export function labeling(label, contents) { - return ( -
- {label} - {contents} -
- ) -} - -export function getNextConcert(id, concertList) { - const type = getConcert(id, concertList).type - const list = concertList.filter((e) => { - return e.type === type - }) - // console.log(list) - var next = undefined - list.forEach((e, i) => { - if (e.id === id) next = i + 1 - return - }) - if (next > list.length - 1) { - return false - } else { - // console.log('next', list[next].id) - return list[next].id - } -} - -export function getPrevConcert(id, concertList) { - const type = getConcert(id, concertList).type - const list = concertList.filter((e) => { - return e.type === type - }) - var prev = undefined - list.forEach((e, i) => { - if (e.id === id) prev = i - 1 - return - }) - if (prev < 0) { - return false - } else { - // console.log('prev', list[prev].id) - return list[prev].id - } -} - -// Audio.jsより -export function getMediaData(id, number, concertList) { - return getConcertList(id, concertList)[number] -} - -export function getAlbum(id, playlist) { - let album - for (var i = 0; i < playlist.length; i++) { - if (playlist[i].id === id) album = playlist[i] - } - return JSON.parse(JSON.stringify(album)) -} - -export function getAudioTitle(id, number, concertList) { - return getConcertList(id, concertList)[number].title -} - -export function getAudioComposer(id, number, concertList) { - var list = getConcertList(id, concertList)[number] - const composer = - 'composer' in list ? ( - 'arranger' in list ? ( - - {list.composer} - {list.composer.match(/民謡/) ? '' : '作曲'} - / - {list.arranger}編曲 - - ) : ( - {list.composer} - ) - ) : 'arranger' in list ? ( - {list.arranger}編曲 - ) : ( - '' - ) - return composer - // 'composer' in data[ml] ? 'arranger' in data[ml] ? {data[ml].composer}{data[ml].composer.match(/民謡/) ? '' : '作曲'}/{data[ml].arranger}編曲 : {data[ml].composer} : '' -} - -// module.exports = { -// getVersion, getUserdata, -// unixTimeFull, getYear, unixDate, unixTime, makeLine, playTime, -// getMediaData, -// getAudioTitle, getConcertTitle, getConcertType, getConcertMusicLabel, -// getAudioComposer, getAudioComposerText, getAudioArrangerText, -// getConcert, listReverse, labeling, escapeReg, -// // for ConcertNavigation -// getNextConcert, getPrevConcert -// } diff --git a/client/src/Component/Auth/Archive/Overview/Overview.js b/client/src/Component/Auth/Archive/Overview/Overview.js deleted file mode 100644 index 9fb61de1..00000000 --- a/client/src/Component/Auth/Archive/Overview/Overview.js +++ /dev/null @@ -1,435 +0,0 @@ -import React, { Component } from 'react' -import { Link } from 'react-router-dom' - -import { connect } from 'react-redux' - -import { - setNavigationTitle, - setNavigationTitleArchiveConcertid, - setBackNavigation, -} from '../../../../Actions/Navigation' -import { getConcertList, setConcertid, getPhotoList, getVideoList } from '../../../../Actions/Archive' -import { archivePlayRequest } from '../../../../Actions/Audio' - -import Forward from '../../../../Library/Icons/Forward' -import Back from '../../../../Library/Icons/Back' -import * as libArchive from '../Library/Library' -import * as lib from '../../../../Library/Library' - -import './Overview.css' - -function mapStateToProps(state) { - return { - pc: state.status.pc, - loadingArchive: state.archive.loading, - concertList: state.archive.concertList, - concertid: state.archive.concertid, - loadingPhoto: state.archive.loadingPhoto, - photoList: state.archive.photoList, - loadingVideo: state.archive.loadingVideo, - videoList: state.archive.videoList, - } -} - -function mapDispatchToProps(dispatch) { - return { - setNavigationTitle(title) { - dispatch(setNavigationTitle(title)) - }, - setNavigationTitleArchiveConcertid(titleConcertid) { - dispatch(setNavigationTitleArchiveConcertid(titleConcertid)) - }, - setBackNavigation(backNavigation, backNavigationPath) { - dispatch(setBackNavigation(backNavigation, backNavigationPath)) - }, - getConcertList() { - dispatch(getConcertList()) - }, - setConcertid(id) { - dispatch(setConcertid(id)) - }, - getPhotoList() { - dispatch(getPhotoList()) - }, - getVideoList() { - dispatch(getVideoList()) - }, - archivePlayRequest(id, number, playRequest) { - dispatch(archivePlayRequest(id, number, playRequest)) - }, - } -} - -class Overview extends Component { - constructor(props) { - super(props) - const { params } = this.props.match - const id = params.id ? params.id : '' - this.props.setConcertid(id) - this.props.setNavigationTitleArchiveConcertid(id) - } - - // 直接アクセスしたときに必要 - componentDidMount() { - this.props.setNavigationTitle('詳細情報') - this.props.setBackNavigation(true, '/archive') - this.props.getConcertList() - this.props.getPhotoList() - this.props.getVideoList() - } - - UNSAFE_componentWillReceiveProps(nextProps) { - const { params } = nextProps.match - if (params.id !== this.props.concertid) { - this.props.setConcertid(params.id) - this.props.setNavigationTitleArchiveConcertid(params.id) - this.props.getPhotoList() - this.props.getVideoList() - } - } - - componentWillUnmount() { - this.props.setNavigationTitleArchiveConcertid(false) - } - - showDate(item) { - if (item.time['time'] && item.time['label']) { - const time = ( -
-
{item.time.date}
-
{item.time.time + item.time.label}
-
- ) - return libArchive.labeling('日時', time) - } - const date =
{item.time.date}
- return libArchive.labeling('開催日', date) - } - - showPlace(item) { - if ('place' in item) { - const place = item.place.map((each, i) => { - return
{each}
- }) - return libArchive.labeling('会場', place) - } - } - - showConductor(item) { - if ('conductor' in item) { - var name = '' - for (var i in item.conductor) { - name += item.conductor[i].name + '・' - } - return libArchive.labeling('指揮', name.slice(0, -1)) - } - } - - showGuest(item) { - // ないときがある - if (item['guest']) { - // if ('guest' in item) { - var list = '' - for (var i in item.guest) { - list = item.guest[i].name + '(' + item.guest[i].instrument + ')' - } - return libArchive.labeling('客演', list) - } - } - - setAudio(number) { - this.props.archivePlayRequest(this.props.concertid, number, true) - } - - showMusic(item) { - var data = item.data - return item.contents.map((list, i) => { - var ml = list.music.map((ml, j) => { - var composer = - 'composer' in data[ml] ? ( - 'arranger' in data[ml] ? ( - - {data[ml].composer} - {data[ml].composer.match(/民謡/) ? '' : '作曲'} - / - {data[ml].arranger}編曲 - - ) : ( - {data[ml].composer} - ) - ) : 'arranger' in data[ml] ? ( - {data[ml].arranger}編曲 - ) : ( - '' - ) - var additional = - 'add' in data[ml] ? ( -
    - {data[ml].add.map((mv, k) => ( -
  1. {mv}
  2. - ))} -
- ) : ( - '' - ) - var movement = - 'movement' in data[ml] ? ( -
    - {data[ml].movement.map((mv, k) => ( -
  1. {mv}
  2. - ))} -
- ) : ( - '' - ) - var clickHandler = - 'audio' in data[ml] - ? () => { - this.setAudio(data[ml].audio) - } - : () => {} - var hasAudio = - 'audio' in data[ml] ? : - return ( -
  • -
    {hasAudio}
    -
    - {data[ml].title} - {composer} - {additional} - {movement} -
    -
  • - ) - }) - return ( -
  • - -
      {ml}
    -
  • - ) - }) - } - - showPoster(item) { - if (item['poster']) { - return - } else { - return ( -
    -
    - NO IMAGE -
    -
    - ) - } - } - - renderConcertNavigation() { - if (this.props.loadingArchive || !this.props.concertList || !this.props.concertid) return - const item = libArchive.getConcert(this.props.concertid, this.props.concertList).detail - const concertList = this.props.concertList - const concertid = this.props.concertid - // reverse()していないので逆になってる - const prevClass = - 'prev ' + - libArchive.getPrevConcert(concertid, concertList) + - ' ' + - libArchive.getConcertType(concertid, concertList) - const prevLink = libArchive.getPrevConcert(concertid, concertList) ? ( - - 次 - - ) : ( - - 次 - - ) - const nextClass = - 'next ' + - libArchive.getNextConcert(concertid, concertList) + - ' ' + - libArchive.getConcertType(concertid, concertList) - const nextLink = libArchive.getNextConcert(concertid, concertList) ? ( - - 前 - - ) : ( - - 前 - - ) - return ( -
    - {nextLink} -

    {item.title}

    - {prevLink} -
    - ) - } - - renderNavigationLink() { - if (this.props.loadingArchive || !this.props.concertList || !this.props.concertid) return - const photoLink = !this.props.photoList ? ( -
  • -
    -
    - 写真 - -
    -
    -
  • - ) : this.props.photoList.length === 0 || this.props.loadingPhoto ? ( -
  • -
    -
    - 写真 - -
    -
    -
  • - ) : ( -
  • - -
    - 写真 - -
    - -
  • - ) - const videoLink = !this.props.videoList ? ( -
  • -
    -
    - 映像 - -
    -
    -
  • - ) : this.props.videoList.length === 0 || this.props.loadingVideo ? ( -
  • -
    -
    - 映像 - -
    -
    -
  • - ) : ( -
  • - -
    - 映像 - -
    - -
  • - ) - return ( -
    -
    -
      - {photoLink} - {videoLink} -
    -
    -
    - ) - } - - renderConcertDetail() { - if (this.props.loadingArchive || !this.props.concertList || !this.props.concertid) - return ( -
    -
    -
    -
    -
    - ) - const item = libArchive.getConcert(this.props.concertid, this.props.concertList).detail - return ( -
    -
    {this.showPoster(item)}
    -
    -
    - - {this.showDate(item)} - {this.showPlace(item)} - {this.showConductor(item)} - {this.showGuest(item)} -
    -
      {this.showMusic(item)}
    -
    -
    - ) - } - - renderBreadNavigation(loadingArchive, concertList, concertid) { - if (loadingArchive || !concertList || !concertid) - return ( -
    - ホーム - - アーカイブ - - -
    - ) - return ( -
    - ホーム - - アーカイブ - - {libArchive.getConcertTitle(concertid, concertList)} -
    - ) - } - - render() { - // State List - const { loadingArchive, concertList, concertid } = this.props - - const showBreadNavigation = this.renderBreadNavigation(loadingArchive, concertList, concertid) - - return ( - -
    - {showBreadNavigation} -

    アーカイブ

    -

    過去のウィンズの活動履歴を確認できます

    -
    - -
    -
    - {this.renderConcertNavigation()} - {this.renderNavigationLink()} -
    {this.renderConcertDetail()}
    -
    -
    - -
    -
    -
      -
    • - -
      - - 一覧へ -
      - -
    • -
    -
    -
    -
    - ) - } -} - -export default connect(mapStateToProps, mapDispatchToProps)(Overview) diff --git a/client/src/Component/Auth/Archive/Photo/Photo.js b/client/src/Component/Auth/Archive/Photo/Photo.js deleted file mode 100644 index 096cb794..00000000 --- a/client/src/Component/Auth/Archive/Photo/Photo.js +++ /dev/null @@ -1,182 +0,0 @@ -import React, { Component } from 'react' -import { Link } from 'react-router-dom' - -import { connect } from 'react-redux' - -import { setNavigationTitle, setBackNavigation } from '../../../../Actions/Navigation' -import { - getConcertList, - setConcertid, - getPhotoList, - resetPhotoList, - setDisplayPhotoSlideModal, -} from '../../../../Actions/Archive' - -import Back from '../../../../Library/Icons/Back' -import * as libArchive from '../Library/Library' -import * as lib from '../../../../Library/Library' - -import './Photo.css' - -function mapStateToProps(state) { - return { - pc: state.status.pc, - - concertList: state.archive.concertList, - concertid: state.archive.concertid, - - loadingPhoto: state.archive.loadingPhoto, - - photoList: state.archive.photoList, - photoUrl: state.archive.photoUrl, - photoBaseSrcThumbnail: state.archive.photoBaseSrcThumbnail, - } -} - -function mapDispatchToProps(dispatch) { - return { - setNavigationTitle(title) { - dispatch(setNavigationTitle(title)) - }, - setBackNavigation(backNavigation, backNavigationPath) { - dispatch(setBackNavigation(backNavigation, backNavigationPath)) - }, - getConcertList() { - dispatch(getConcertList()) - }, - setConcertid(id) { - dispatch(setConcertid(id)) - }, - getPhotoList() { - dispatch(getPhotoList()) - }, - resetPhotoList() { - dispatch(resetPhotoList()) - }, - setDisplayPhotoSlideModal(displayPhotoSlideModal, photoNumber) { - dispatch(setDisplayPhotoSlideModal(displayPhotoSlideModal, photoNumber)) - }, - } -} - -class Photo extends Component { - constructor(props) { - super(props) - const { params } = this.props.match - const id = params.id ? params.id : '' - this.props.setConcertid(id) - id !== '' - ? this.props.setBackNavigation(true, '/archive/overview/' + id) - : this.props.setBackNavigation(true, '/archive') - } - - UNSAFE_componentWillMount() { - this.props.getPhotoList() - } - - // 直接アクセスしたときに必要 - componentDidMount() { - this.props.setNavigationTitle('写真') - // パンくずリスト用 - this.props.getConcertList() - } - - UNSAFE_componentWillReceiveProps(nextProps) { - const { params } = nextProps.match - params.id ? this.props.setConcertid(params.id) : false - } - - componentWillUnmount() { - this.props.resetPhotoList() - } - - openPhoto(i) { - this.props.setDisplayPhotoSlideModal(true, i) - } - - renderPhoto() { - if (this.props.loadingPhoto || !this.props.photoList) - return ( -
    -
    -
    -
    -
    - ) - const photoList = this.props.photoList.map((each, i) => { - return ( -
    this.openPhoto(i)}> - -
    - ) - }) - return
    {photoList}
    - } - - renderBreadNavigation() { - if (!this.props.concertList || !this.props.concertid) { - return ( -
    - ホーム - - アーカイブ - - - - -
    - ) - } - return ( -
    - ホーム - - アーカイブ - - - {libArchive.getConcertTitle(this.props.concertid, this.props.concertList)} - - - 写真 -
    - ) - } - - render() { - const showBreadNavigation = this.renderBreadNavigation() - const showPhoto = this.renderPhoto() - - return ( - -
    - {showBreadNavigation} -

    写真

    -

    過去のウィンズの活動履歴を確認できます

    -
    - -
    {showPhoto}
    - -
    -
    -
      -
    • - -
      - - 一覧へ -
      - -
    • -
    -
    -
    -
    - ) - } -} - -export default connect(mapStateToProps, mapDispatchToProps)(Photo) diff --git a/client/src/Component/Auth/Archive/PhotoSlide/PhotoSlide.js b/client/src/Component/Auth/Archive/PhotoSlide/PhotoSlide.js deleted file mode 100644 index ad881431..00000000 --- a/client/src/Component/Auth/Archive/PhotoSlide/PhotoSlide.js +++ /dev/null @@ -1,142 +0,0 @@ -import React, { Component } from 'react' - -import { connect } from 'react-redux' - -import Swiper from 'react-id-swiper' -// import Swiper from 'swiper' - -import { setDisplayPhotoSlideModal } from '../../../../Actions/Archive' - -import * as lib from '../../../../Library/Library' - -import './PhotoSlide.css' - -function mapStateToProps(state) { - return { - pc: state.status.pc, - - concertid: state.archive.concertid, - loadingPhoto: state.archive.loadingPhoto, - - photoList: state.archive.photoList, - photoUrl: state.archive.photoUrl, - photoBaseSrcOriginal: state.archive.photoBaseSrcOriginal, - - displayPhotoSlideModal: state.archive.displayPhotoSlideModal, - photoNumber: state.archive.photoNumber, - } -} - -function mapDispatchToProps(dispatch) { - return { - setDisplayPhotoSlideModal(displayPhotoSlideModal, photoNumber) { - dispatch(setDisplayPhotoSlideModal(displayPhotoSlideModal, photoNumber)) - }, - } -} - -class PhotoSlide extends Component { - renderPhotoSlide() { - if (this.props.loadingPhoto || !this.props.photoList) - return ( -
    -
    -
    -
    -
    - ) - const photoList = this.props.photoList.map((each, i) => { - return ( -
    -
    this.props.setDisplayPhotoSlideModal(false, undefined)}> - {/* e.stopPropagation()} /> */} - e.stopPropagation()} - className="swiper-lazy" - /> - {/*
    */} -
    - -
    - {/*
    */} -
    -
    - ) - }) - const params = { - spaceBetween: 45, - grabCursor: true, - navigation: { - nextEl: '.swiper-custom-button-next', - prevEl: '.swiper-custom-button-prev', - }, - renderPrevButton: () => ( - - - - ), - renderNextButton: () => ( - - - - ), - - // カーソルキーでの操作 - keyboard: true, - // スライドごとにwrapperのサイズを変更 - watchSlidesProgress: true, - // 最初のスライドを指定 - // activeSlideKey: this.props.photoNumber.toString() - initialSlide: this.props.photoNumber, - // 次のスライドがどれくらい見えていたら次へ行くか - longSwipesRatio: 0.4, - preloadImages: false, - // preloadImages: false, - lazy: true, - // lazy: { - // loadPrevNext: true, - // loadPrevNextAmount: 10, - // // スライド開始時にロードする - // // loadOnTransitionStart: false, - // }, - // preloaderClass: 'swiper-lazy-preloader-loading' - } - return ( -
    - {photoList} -
    - ) - } - - render() { - if (!this.props.displayPhotoSlideModal) return
    - - const showPhotoSlide = this.renderPhotoSlide() - const displayPhotoSlideModalClass = this.props.displayPhotoSlideModal ? ' open' : '' - - return ( -
    -
    -
    this.props.setDisplayPhotoSlideModal(false, undefined)} - > - × -
    - {showPhotoSlide} -
    -
    this.props.setDisplayPhotoSlideModal(false, undefined)} - >
    -
    - ) - } -} - -const CustomButton = ({ className, children, pc }) => { - return
    {children}
    -} - -export default connect(mapStateToProps, mapDispatchToProps)(PhotoSlide) diff --git a/client/src/Component/Auth/Archive/PhotoSlide/PhotoSlide.scss b/client/src/Component/Auth/Archive/PhotoSlide/PhotoSlide.scss deleted file mode 100644 index e2d190ea..00000000 --- a/client/src/Component/Auth/Archive/PhotoSlide/PhotoSlide.scss +++ /dev/null @@ -1,173 +0,0 @@ -.photo-slide-modal { - .photo-slide-modal-contents { - position: fixed; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: #fff; - z-index: 51; - background: rgba(0, 0, 0, 0); - - // transition: transform .3s ease-in-out; - transition: transform 0.2s ease-in-out; - -webkit-transform: translate3d(0, 105%, 0); - transform: translate3d(0, 105%, 0); - -webkit-overflow-scrolling: touch; - - // &.pc { - // width: 900px; - // left: calc(50% - 450px); - // } - - &.open { - transition: transform 0.4s ease; - -webkit-transform: translate3d(0, 0%, 0); - transform: translate3d(0, 0%, 0); - // box-shadow: 6px 0 25px rgba(0,0,0,.15); - - &.pc { - // -webkit-transform: translateY(20%); - // transform: translateY(20%); - } - - .photo-slide-modal-close { - position: fixed; - top: calc(constant(safe-area-inset-top) + 12px); - top: calc(env(safe-area-inset-top) + 12px); - right: calc(constant(safe-area-inset-right) + 12px); - right: calc(env(safe-area-inset-right) + 12px); - width: 24px; - padding: 4px; - border-radius: 16px; - text-align: center; - color: #fff; - font-size: 24px; - line-height: 24px; - cursor: pointer; - z-index: 52; - - &:hover, - &:active { - background: rgba(255, 255, 255, 0.2); - } - } - } - - .swiper-container { - // background: rgba(0,0,0,.8); - - .swiper-custom-button-prev, - .swiper-custom-button-next { - position: absolute; - top: 50%; - width: 24px; - height: 36px; - margin-top: -18px; - z-index: 10; - color: #fff; - font-size: 36px; - cursor: pointer; - background: none; - opacity: 0.6; - - &.mobile { - display: none; - } - - &:hover { - opacity: 0.8; - } - - &.swiper-button-disabled { - opacity: 0.35; - cursor: auto; - pointer-events: none; - } - } - - .swiper-custom-button-prev { - left: 10px; - right: auto; - } - .swiper-custom-button-next { - right: 10px; - left: auto; - } - } - - .archive-photo-slide { - background: rgba(0, 0, 0, 0); - - .swiper-container { - background: rgba(0, 0, 0, 0); - .swiper-wrapper { - background: rgba(0, 0, 0, 0); - .swiper-slide { - background: rgba(0, 0, 0, 0); - } - } - } - - .each-original { - width: 100%; - height: 100vh; - display: flex; - align-items: center; - justify-content: center; - background: rgba(0, 0, 0, 0); - - img { - display: block; - width: 100%; - max-width: 800px; - height: auto; - max-height: 100vh; - object-fit: contain; - z-index: 11; - } - - .swiper-lazy-preloader { - width: 36px; - height: 36px; - position: absolute; - left: 50%; - top: 50%; - margin-left: -18px; - margin-top: -18px; - font-size: 36px; - text-align: center; - z-index: 10; - - -webkit-transform-origin: 50%; - -ms-transform-origin: 50%; - transform-origin: 50%; - -webkit-animation: none; - animation: none; - - &::after { - display: none; - } - } - } - } - } - - .photo-slide-modal-background { - display: none; - position: fixed; - z-index: 50; - top: 0; - left: 0; - width: 100vw; - height: 100vh; - background: black; - - &.open { - display: block; /*カバーを表示*/ - opacity: 0.95; - // transition: all 3s ease-in-out; - // animation: menu-background-show .3s ease-in-out 0s; - } - } -} diff --git a/client/src/Component/Auth/Archive/Video/Video.js b/client/src/Component/Auth/Archive/Video/Video.js deleted file mode 100644 index 5e5bdf99..00000000 --- a/client/src/Component/Auth/Archive/Video/Video.js +++ /dev/null @@ -1,380 +0,0 @@ -import React, { Component } from 'react' -import { Link } from 'react-router-dom' - -import { connect } from 'react-redux' - -import { setNavigationTitle, setBackNavigation } from '../../../../Actions/Navigation' -import { - getConcertList, - setConcertid, - getVideoList, - resetVideo, - setVideoRef, - setLoadingVideoSource, - videoLoadPercentUpdate, - videoPlayUpdate, - videoPlayRequest, - videoPlay, - videoPause, - videoStop, - // setDisplayVideoController, - countUp, -} from '../../../../Actions/Archive' - -import Back from '../../../../Library/Icons/Back' -import * as libArchive from '../Library/Library' -import * as lib from '../../../../Library/Library' - -import './Video.css' - -function mapStateToProps(state) { - return { - pc: state.status.pc, - - loading: state.archive.loading, - concertList: state.archive.concertList, - concertid: state.archive.concertid, - - loadingVideo: state.archive.loadingVideo, - - videoList: state.archive.videoList, - videoBaseSrc: state.archive.videoBaseSrc, - videoUrl: state.archive.videoUrl, - videoPoster: state.archive.videoPoster, - - videoRef: state.archive.videoRef, - - displayPhotoController: state.archive.displayPhotoController, - - videoPlayStatus: state.archive.videoPlayStatus, - videoPlayTrack: state.archive.videoPlayTrack, - - countFlag: state.archive.countFlag, - } -} - -function mapDispatchToProps(dispatch) { - return { - setNavigationTitle(title) { - dispatch(setNavigationTitle(title)) - }, - setBackNavigation(backNavigation, backNavigationPath) { - dispatch(setBackNavigation(backNavigation, backNavigationPath)) - }, - getConcertList() { - dispatch(getConcertList()) - }, - setConcertid(id) { - dispatch(setConcertid(id)) - }, - getVideoList() { - dispatch(getVideoList()) - }, - resetVideo() { - dispatch(resetVideo()) - }, - setVideoRef(videoRef) { - dispatch(setVideoRef(videoRef)) - }, - setLoadingVideoSource(status) { - dispatch(setLoadingVideoSource(status)) - }, - videoLoadPercentUpdate(percent) { - dispatch(videoLoadPercentUpdate(percent)) - }, - videoPlayUpdate(videoCurrent, videoDuration) { - dispatch(videoPlayUpdate(videoCurrent, videoDuration)) - }, - videoPlayRequest(number, request) { - dispatch(videoPlayRequest(number, request)) - }, - videoPlay(e) { - dispatch(videoPlay(e)) - }, - videoPause(e) { - dispatch(videoPause(e)) - }, - videoStop(e) { - dispatch(videoStop(e)) - }, - // setDisplayVideoController (displayVideoSlideModal, videoNumber) { - // dispatch(setDisplayVideoController(displayVideoSlideModal, videoNumber)) - // }, - countUp() { - dispatch(countUp()) - }, - } -} - -class Video extends Component { - constructor(props) { - super(props) - const { params } = this.props.match - const id = params.id ? params.id : '' - const track = !isNaN(params.track) ? parseInt(params.track) : undefined - this.props.setConcertid(id) - id !== '' - ? this.props.setBackNavigation(true, '/archive/overview/' + id) - : this.props.setBackNavigation(true, '/archive') - track ? this.props.videoPlayRequest(track, false) : false - } - - UNSAFE_componentWillMount() { - this.props.getVideoList() - } - - // 直接アクセスしたときに必要 - componentDidMount() { - this.props.setNavigationTitle('映像') - // パンくずリスト用 - this.props.getConcertList() - } - - UNSAFE_componentWillReceiveProps(nextProps) { - const { params } = nextProps.match - params.id ? this.props.setConcertid(params.id) : false - } - - componentWillUnmount() { - // this.props.videoStop() - this.props.resetVideo() - this.props.setVideoRef(undefined) - } - - onLoadStart() { - // console.log('読み込み開始', e) - if (this.props.videoRef.src) { - this.props.setLoadingVideoSource(true) - } - } - - onLoadedMetadata(e) { - if (!isNaN(e.target.duration)) { - this.props.videoPlayUpdate(this.props.current, e.target.duration) - } else { - this.props.videoPlayUpdate(this.props.current, undefined) - } - } - - onLoadedData(e) { - if (!isNaN(e.target.duration)) { - this.props.videoPlayUpdate(this.props.current, e.target.duration) - } else { - this.props.videoPlayUpdate(this.props.current, undefined) - } - } - - onDurationChange(e) { - if (!isNaN(e.target.duration)) { - this.props.videoPlayUpdate(this.props.current, e.target.duration) - } else { - this.props.videoPlayUpdate(this.props.current, undefined) - } - } - - onProgress(e) { - if (e.target.buffered.length > 0) { - this.props.videoLoadPercentUpdate( - Math.round((e.target.buffered.end(e.target.buffered.length - 1) / e.target.duration) * 1000) / 10 - ) - } else { - this.props.videoLoadPercentUpdate(undefined) - } - } - - onCanPlayThrough() { - this.props.setLoadingVideoSource(false) - } - - onError() { - this.props.setLoadingVideoSource(true) - } - - onTimeUpdate(e) { - if (!isNaN(e.target.duration)) { - this.props.videoPlayUpdate(e.target.currentTime, e.target.duration) - if (this.props.countFlag && e.target.currentTime > 0) { - this.props.countUp() - } - } else { - this.props.videoPlayUpdate(undefined, undefined) - } - } - - onEnded() { - this.playNext() - } - - playNext() { - // 確認 - if (this.props.videoList.length > this.props.videoPlayTrack + 1) { - // 次のトラックへ - this.props.videoPlayRequest(this.props.videoPlayTrack + 1, true) - } else { - this.props.videoPause() - } - } - - onClick(e) { - e.preventDefault() - this.props.videoPlayStatus ? this.props.videoPause() : this.props.videoPlay() - } - - renderVideoList() { - if (this.props.loading || this.props.loadingVideo || !this.props.videoList) - return ( -
    -
    -
    -
    -
    - ) - const concert = libArchive.getConcert(this.props.concertid, this.props.concertList).detail - // 初期値 - var trackCount = 0 - return concert.contents.map((item, i) => { - // console.log(item) - const trackList = item.music.map((num, i) => { - // return this.renderTrack(num) - const trackData = this.props.videoList.filter((e) => { - return e.data === num - }) - // console.log(trackData) - return trackData.map((each, j) => { - const trackNumber = trackCount - trackCount += 1 - const title = - each.data !== false - ? libArchive.getAudioTitle(this.props.concertid, each.data, this.props.concertList) - : each.title - const addTitle = each.addtitle ? ' ' + each.addtitle : '' - const composer = - each.data !== false ? ( - - {libArchive.getAudioComposer(this.props.concertid, each.data, this.props.concertList)} - - ) : each.composer ? ( - {each.composer} - ) : ( - '' - ) - const type = libArchive.getConcertType(this.props.concertid, this.props.concertList) - return ( -
    this.props.videoPlayRequest(trackNumber, true)} - > - {/*
    this.selectPlay(trackNumber)}> */} -
    - -
    -
    - {title + addTitle} - {composer} -
    -
    - ) - }) - }) - return ( -
    - - {trackList} -
    - ) - }) - } - - renderBreadNavigation() { - if (!this.props.concertList || !this.props.concertid) { - return ( -
    - ホーム - - アーカイブ - - - - -
    - ) - } - return ( -
    - ホーム - - アーカイブ - - - {libArchive.getConcertTitle(this.props.concertid, this.props.concertList)} - - - 映像 -
    - ) - } - - render() { - const showBreadNavigation = this.renderBreadNavigation() - const showVideoList = this.renderVideoList() - const poster = this.props.videoPoster ? this.props.videoPoster : 'false' - const aspectClass = - this.props.videoPoster === 'https://video.winds-n.com/poster_800_586.png' ? ' aspect-4-3' : ' aspect-16-9' - return ( - -
    - {showBreadNavigation} -

    映像

    -
    - -
    -
    -
    - -
    -
    -
    {showVideoList}
    -
    - -
    -
    -
      -
    • - -
      - - 一覧へ -
      - -
    • -
    -
    -
    -
    - ) - } -} - -export default connect(mapStateToProps, mapDispatchToProps)(Video) diff --git a/client/src/Component/Auth/Archive/VideoController/VideoController.js b/client/src/Component/Auth/Archive/VideoController/VideoController.js deleted file mode 100644 index 362c6265..00000000 --- a/client/src/Component/Auth/Archive/VideoController/VideoController.js +++ /dev/null @@ -1,137 +0,0 @@ -import React, { Component } from 'react' - -import { connect } from 'react-redux' - -import * as lib from '../../../../Library/Library' -import * as libArchive from '../../Archive/Library/Library' - -import { videoPlay, videoPause, videoStop } from '../../../../Actions/Archive' - -import './VideoController.css' -// import lib from 'react-confirm-alert'; - -function mapStateToProps(state) { - return { - pc: state.status.pc, - - concertList: state.archive.concertList, - - videoConcertid: state.archive.videoConcertid, - - videoRef: state.archive.videoRef, - displayVideoController: state.archive.displayVideoController, - loadingVideoSource: state.archive.loadingVideoSource, - videoLoadPercent: state.archive.videoLoadPercent, - - videoCurrent: state.archive.videoCurrent, - videoCurrentTime: state.archive.videoCurrentTime, - videoDuration: state.archive.videoDuration, - videoDurationTime: state.archive.videoDurationTime, - videoPlayPercent: state.archive.videoPlayPercent, - - videoPlayStatus: state.archive.videoPlayStatus, - } -} - -function mapDispatchToProps(dispatch) { - return { - videoPlay(e) { - dispatch(videoPlay(e)) - }, - videoPause(e) { - dispatch(videoPause(e)) - }, - videoStop(e) { - dispatch(videoStop(e)) - }, - } -} - -class VideoController extends Component { - constructor(props) { - super(props) - this.videoProgress = React.createRef() - this.videoLoadProgress = React.createRef() - } - - seekProgress(e) { - const total = Math.round(this.props.videoRef.duration) - if (!isNaN(total)) { - // console.log(e.pageX, this.audioProgress.clientWidth) - this.props.videoRef.currentTime = Math.round(total * (e.pageX / this.videoProgress.clientWidth)) - } - } - - renderPlayTime() { - if (this.props.videoCurrent && this.props.videoDuration) { - return ( -
    - {this.props.videoCurrentTime} - {this.props.videoDurationTime} -
    - ) - } else { - return ( -
    - 00:00 - 00:00 -
    - ) - } - } - - render() { - const displayVideoControllerClass = this.props.displayVideoController ? ' open' : '' - const button = this.props.videoPlayStatus ? ( - !this.props.loadingVideoSource || this.props.videoCurrent || this.props.videoDuration ? ( - - ) : ( - - ) - ) : ( - - ) - const playStatusClass = this.props.videoPlayStatus ? ' playing' : '' - const playTime = this.renderPlayTime() - const playProgress = this.props.videoPlayPercent - ? { backgroundSize: this.props.videoPlayPercent + '% 100%' } - : { backgroundSize: '0% 100%' } - const loadProgress = this.props.videoLoadPercent - ? { backgroundSize: this.props.videoLoadPercent + '% 100%' } - : { backgroundSize: '0% 100%' } - const playTypeClass = - this.props.videoConcertid && this.props.concertList - ? ' ' + libArchive.getConcertType(this.props.videoConcertid, this.props.concertList) - : false - return ( -
    -
    - - -
    (this.videoProgress = i)} - onClick={(e) => this.seekProgress(e)} - > - {playTime} -
    -
    (this.videoLoadProgress = i)} - >
    -
    -
    - ) - } -} - -export default connect(mapStateToProps, mapDispatchToProps)(VideoController) diff --git a/client/src/Component/Auth/Auth.js b/client/src/Component/Auth/Auth.js deleted file mode 100644 index 6016a762..00000000 --- a/client/src/Component/Auth/Auth.js +++ /dev/null @@ -1,149 +0,0 @@ -import React, { Component } from 'react' -import { Route, Switch, Redirect } from 'react-router-dom' - -import { connect } from 'react-redux' -import { loginAuth, windowWidthChange } from '../../Actions/Status' -import { audioPlay, audioPause } from '../../Actions/Audio' - -import Home from './Home/Home' -import Practice from './Practice/Practice' -import Manager from './Manager/Manager' -import BBS from './BBS/BBS' - -import Archive from './Archive/Archive' -import ArchivePhotoSlide from './Archive/PhotoSlide/PhotoSlide' -import ArchiveVideoController from './Archive/VideoController/VideoController' -import Score from './Score/Score' -import ScoreModal from './Score/ScoreModal/ScoreModal' -import ScoreEditModal from './Score/EditModal/EditModal' -import ScoreBoxModal from './Score/BoxModal/BoxModal' - -import Setting from './Setting/Setting' - -import Tutorial from './Tutorial/Tutorial' - -import NavigationHeader from './Component/NavigationHeader/NavigationHeader' -import NavigationInline from './Component/NavigationInline/NavigationInline' - -import Audio from './Component/Audio/Audio' - -import Loading from '../Loading/Loading' - -import './Auth.css' - -function mapStateToProps(state) { - return { - login: state.status.login, - loading: state.status.loading, - pc: state.status.pc, - contentsRef: state.status.contentsRef, - displayPlayer: state.audio.displayPlayer, - playStatus: state.audio.playStatus, - } -} - -function mapDispatchToProps(dispatch) { - return { - loginAuth(location) { - dispatch(loginAuth(location)) - }, - windowWidthChange() { - dispatch(windowWidthChange()) - }, - audioPlay() { - dispatch(audioPlay()) - }, - audioPause() { - dispatch(audioPause()) - }, - } -} - -class Auth extends Component { - constructor(props) { - super(props) - this.contentsRef = React.createRef() - } - - UNSAFE_componentWillMount() { - // 過去のlocation情報が存在する場合はそのページへRedirect - this.props.loginAuth(window.localStorage.location ? window.localStorage.location : false) - } - - UNSAFE_componentWillReceiveProps(nextProps) { - if (this.props.location.pathname !== nextProps.location.pathname) { - if (this.contentsRef) { - if (this.contentsRef.scrollTop) { - this.contentsRef.scrollTop = 0 - } - } - } - } - - componentDidMount() { - this.props.windowWidthChange() - window.addEventListener('resize', () => { - this.props.windowWidthChange() - }) - } - - componentWillUnmount() { - window.removeEventListener('resize', () => {}) - } - - onKeyPress(e) { - if (!this.props.displayPlayer) return false - if (e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA' && e.which === 32) { - this.props.playStatus ? this.props.audioPause() : this.props.audioPlay() - } - } - - render() { - const { login, loading, pc, displayPlayer } = this.props - if (loading) return - if (!login) return - const gap = displayPlayer ?
    : false - return ( -
    this.onKeyPress(e)} tabIndex="0"> - {/* */} - -
    -
    { - this.contentsRef = i - }} - > -
    - -
    - - - - - - - - - -
    -
    -
    - © The Wind Ensemble -
    - {gap} -
    -
    -
    - ) - } -} - -export default connect(mapStateToProps, mapDispatchToProps)(Auth) diff --git a/client/src/Component/Auth/Auth.scss b/client/src/Component/Auth/Auth.scss deleted file mode 100644 index 7a758134..00000000 --- a/client/src/Component/Auth/Auth.scss +++ /dev/null @@ -1,686 +0,0 @@ -.auth { - & { - color: #333; - } - @media (prefers-color-scheme: dark) { - & { - color: #eee; - } - } - - .contents { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - display: block; - margin: 44.5px 0 0 0; - - .contents-inner { - height: 100%; - overflow-x: hidden; - overflow-y: scroll; - -webkit-overflow-scrolling: touch; - overflow-scrolling: touch; - // Chromeだけっぽい - // scroll-behavior: smooth; - will-change: scroll-position; - contain: size style layout; - transform: translateZ(0); // Retinaスクロール対策 - } - - z-index: 1; - - transform: translateZ(0); // Retinaスクロール対策 - - margin-top: calc(constant(safe-area-inset-top) + 44.5px); - // margin-bottom: constant(safe-area-inset-bottom); - margin-left: constant(safe-area-inset-left); - margin-right: constant(safe-area-inset-right); - - margin-top: calc(env(safe-area-inset-top) + 44.5px); - // margin-bottom: env(safe-area-inset-bottom); - margin-left: env(safe-area-inset-left); - margin-right: env(safe-area-inset-right); - - // background: rgba(220,220,220,.2); - // background: #efeff4; - // background: #f3f2f8; - // background: rgb(230, 236, 240); - - & { - background: #efeff4; - } - @media (prefers-color-scheme: dark) { - & { - background: #000; - } - } - - &.pc { - margin: 61px 0 0 0; - } - - // &.mobile { - // margin-top: calc(12px + 45px); - // } - - div.flex-frame { - // menu: 240px, contents: 900px, margin: 16px * 4 - max-width: 1204px; - margin: 0 auto; - - display: flex; - flex-direction: row; - justify-content: center; - align-items: flex-start; - } - - // pcモードのとき追加 - .inline-contents { - width: 900px; - min-width: 0; // 長いテキストを表示したときに要素を可変にするため - margin: 36px 16px 36px; - } - - // mobileモードのとき追加 - .full-contents { - margin: 32px 0; - } - - .gap { - height: calc(constant(safe-area-inset-bottom) + 65px); - height: calc(env(safe-area-inset-bottom) + 65px); - } - - .contents-header { - margin: 0; - padding: 12px 0; - - & { - background: #fff; - } - @media (prefers-color-scheme: dark) { - & { - background: #1c1c1e; - } - } - - &.pc { - padding: 16px 0; - - .bread-navigation { - padding: 0 16px; - font-size: 13px; - } - - h2 { - padding: 0 16px; - } - - p { - padding: 0 16px; - } - } - - &.mobile { - & { - border-top: 0.55px solid #cbcbcd; - border-bottom: 0.55px solid #cbcbcd; - } - @media (prefers-color-scheme: dark) { - & { - border-top: 0.55px solid #2d2d2f; - border-bottom: 0.55px solid #2d2d2f; - } - } - } - - .bread-navigation { - padding: 0 12px; - font-size: 12px; - color: #888; - - & { - color: #888; - } - @media (prefers-color-scheme: dark) { - & { - color: #777; - } - } - - a { - text-decoration: none; - - &:hover { - text-decoration: underline; - } - - & { - color: #888; - } - @media (prefers-color-scheme: dark) { - & { - color: #777; - } - } - } - - i { - padding: 0 0.6em; - font-size: 10px; - } - - span { - & { - color: #666; - } - @media (prefers-color-scheme: dark) { - & { - color: #999; - } - } - } - } - - h2 { - margin: 8px 0; - padding: 0 12px; - font-size: 16px; - font-weight: normal; - } - - p { - margin: 0; - padding: 0 12px; - font-size: 0.9rem; - } - } - - .box-label { - margin: 32px 0 11px; - padding: 0 0 0 12px; - font-size: 12px; - - & { - color: #333; - } - @media (prefers-color-scheme: dark) { - & { - color: #ccc; - } - } - - & + .box { - margin: 0 0 32px 0; - } - - &.pc { - padding: 0 0 0 16px; - } - } - - // 標準box - .box { - margin: 32px 0 32px 0; - // padding: 12px 0 0; - - & { - background: #fff; - } - @media (prefers-color-scheme: dark) { - & { - background: #1c1c1e; - } - } - - // &.box-no-background { - // background: inherit; - // } - - &.pc { - .title-frame > label { - padding: 8px 16px; - font-size: 20px; - } - - .text { - // padding: 13px 16px 14px; - padding: 16px; - font-size: 1rem; - } - - .link ul li a .inner { - padding-left: 16px; - } - - .link ul li .disabled-link .inner { - padding-left: 16px; - } - - .link ul li .link-button .inner { - padding-left: 16px; - } - - .back-link ul li a .inner { - padding-left: 16px; - } - } - - &.mobile { - & { - border-top: 0.55px solid #cbcbcd; - border-bottom: 0.55px solid #cbcbcd; - } - @media (prefers-color-scheme: dark) { - & { - border-top: 0.55px solid #2d2d2f; - border-bottom: 0.55px solid #2d2d2f; - } - } - } - - // border-top: .55px solid #c8c7cc; - // border-bottom: .55px solid #c8c7cc; - - .title-frame { - // タイトルSticky用 - // padding: 12px 0 0; - - & > label { - display: block; - // margin: 8px 0; - // padding: 4px 0 4px 12px; - padding: 0 12px; - // border-bottom: .55px dotted #c8c7cc; - font-size: 18px; - letter-spacing: 0.1rem; - - & { - background: #fff; - border-bottom: 0.55px solid #cbcbcd; - } - @media (prefers-color-scheme: dark) { - & { - background: #1c1c1e; - border-bottom: 0.55px solid #2d2d2f; - } - } - - // position: -webkit-sticky; - // position: sticky; - // top: 0; - - line-height: 44px; - // position: relative; - // border-bottom: .55px solid #c8c7cc; - - // &::before { - // display: block; - // content: ''; - // padding-top: 12px; - // } - } - } - - .text { - // padding: 13px 16px 14px; - padding: 12px; - font-size: 0.9rem; - - p { - margin: 0; - padding: 0; - } - } - - .link { - font-size: 1rem; - - ul { - margin: 0; - padding: 0; - // border-top: .55px solid #c8c7cc; - - li { - list-style: none; - // border-bottom: .55px solid #c8c7cc; - - a { - display: block; - margin: 0; - - text-decoration: none; - - & { - color: #333; - - &:hover { - background: #e6e5eb; - } - - &:active { - background: #e6e5eb; - } - } - @media (prefers-color-scheme: dark) { - & { - color: #ccc; - - &:hover { - background: #2c2c2e; - } - - &:active { - background: #2c2c2e; - } - } - } - } - - &.link { - cursor: pointer; - } - - .inner { - padding-left: 12px; - cursor: pointer; - - display: flex; - justify-content: space-between; - align-items: center; - - span { - // margin: 11px 8px 11px 0; - line-height: 44px; - font-size: 16px; - } - - i { - padding-right: 12px; - color: #666; - font-size: 1.2rem; - } - } - - .disabled-link { - display: block; - margin: 0; - - text-decoration: none; - - & { - color: #ccc; - } - @media (prefers-color-scheme: dark) { - & { - color: #333; - } - } - - .inner { - display: flex; - justify-content: space-between; - align-items: center; - cursor: default; - - span { - // margin: 11px 8px 11px 0; - line-height: 44px; - font-size: 16px; - } - - i { - padding-right: 12px; - color: #eee; - font-size: 1.2rem; - } - - svg { - fill: #eee; - - & { - fill: #eee; - } - @media (prefers-color-scheme: dark) { - & { - fill: #333; - } - } - } - } - } - - .link-button { - // padding-left: 12px; - cursor: pointer; - - display: flex; - justify-content: space-between; - align-items: center; - - & { - color: #333; - - &:hover { - background: #e6e5eb; - } - - &:active { - background: #e6e5eb; - } - } - @media (prefers-color-scheme: dark) { - & { - color: #ccc; - - &:hover { - background: #2c2c2e; - } - - &:active { - background: #2c2c2e; - } - } - } - span { - // margin: 11px 8px 11px 0; - line-height: 44px; - font-size: 16px; - } - } - } - } - } - - &.back-to-home { - padding: 0; - // border: 0; - } - - .back-link { - font-size: 1rem; - line-height: 1.6; - - ul { - margin: 0; - padding: 0; - // border-top: .55px solid #c8c7cc; - - li { - list-style: none; - // border-bottom: .55px solid #c8c7cc; - - a { - display: block; - margin: 0; - - text-decoration: none; - - & { - color: #333; - - &:hover { - background: #e6e5eb; - } - - &:active { - background: #e6e5eb; - } - } - @media (prefers-color-scheme: dark) { - & { - color: #ccc; - - &:hover { - background: #2c2c2e; - } - - &:active { - background: #2c2c2e; - } - } - } - - .inner { - padding-left: 12px; - display: flex; - justify-content: flex-start; - align-items: center; - - span { - // margin: 11px 8px 11px 0; - line-height: 44px; - font-size: 16px; - } - - i { - padding-right: 8px; - color: #666; - font-size: 1.2rem; - } - } - } - } - } - } - } - } - - footer { - width: 100%; - margin: 48px 0; - text-align: center; - color: #888; - } -} - -.border-top { - & { - border-top: 0.55px solid #cbcbcd; - } - @media (prefers-color-scheme: dark) { - & { - border-top: 0.55px solid #2d2d2f; - } - } -} - -.border-bottom { - & { - border-bottom: 0.55px solid #cbcbcd; - } - @media (prefers-color-scheme: dark) { - & { - border-bottom: 0.55px solid #2d2d2f; - } - } -} - -.no-border-top { - border-top: 0 !important; -} - -.no-border-bottom { - border-bottom: 0 !important; -} - -.mobile { - &.border-top-mobile { - & { - border-top: 0.55px solid #cbcbcd; - } - @media (prefers-color-scheme: dark) { - & { - border-top: 0.55px solid #2d2d2f; - } - } - } - - &.border-bottom-mobile { - & { - border-bottom: 0.55px solid #cbcbcd; - } - @media (prefers-color-scheme: dark) { - & { - border-bottom: 0.55px solid #2d2d2f; - } - } - } - - &.no-border-top-mobile { - border-top: 0 !important; - } - - &.no-border-bottom-mobile { - border-bottom: 0 !important; - } -} - -.send-button { - display: block; - width: 100%; - height: 44px; - line-height: 44px; - margin: 0 auto; - padding: 0; - border: none; - color: rgba(182, 0, 5, 1); - font-size: 16px; - text-align: center; - cursor: pointer; - transition: all ease-in-out 0.2s; - - & { - background: #fff; - - &:hover, - &:focus { - background: #e6e5eb; - } - - &:active { - background: #e6e5eb; - } - } - @media (prefers-color-scheme: dark) { - & { - background: #1c1c1e; - - &:hover, - &:focus { - background: #2c2c2e; - } - - &:active { - background: #2c2c2e; - } - } - } - - i { - margin-right: 0.2em; - } -} diff --git a/client/src/Component/Auth/BBS/BBS.js b/client/src/Component/Auth/BBS/BBS.js deleted file mode 100644 index dbc5e61b..00000000 --- a/client/src/Component/Auth/BBS/BBS.js +++ /dev/null @@ -1,52 +0,0 @@ -import React, { Component } from 'react' -import { Route, Switch, Link } from 'react-router-dom' - -import { connect } from 'react-redux' - -import Back from '../../../Library/Icons/Back' -import * as lib from '../../../Library/Library' - -import Home from './Home/Home' -import Post from './Post/Post' - -import './BBS.css' - -function mapStateToProps(state) { - return { - pc: state.status.pc, - } -} - -function mapDispatchToProps() { - return {} -} - -class Archive extends Component { - render() { - return ( -
    - - - - - -
    -
    -
      -
    • - -
      - - ホーム -
      - -
    • -
    -
    -
    -
    - ) - } -} - -export default connect(mapStateToProps, mapDispatchToProps)(Archive) diff --git a/client/src/Component/Auth/BBS/BBS.scss b/client/src/Component/Auth/BBS/BBS.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/client/src/Component/Auth/BBS/Home/Home.js b/client/src/Component/Auth/BBS/Home/Home.js deleted file mode 100644 index 82d59c0b..00000000 --- a/client/src/Component/Auth/BBS/Home/Home.js +++ /dev/null @@ -1,169 +0,0 @@ -import React, { Component } from 'react' -import { Link } from 'react-router-dom' - -import { connect } from 'react-redux' - -import * as lib from '../../../../Library/Library' - -import { setNavigationTitle, setBackNavigation } from '../../../../Actions/Navigation' -import { getBBSList, loadMore } from '../../../../Actions/BBS' - -import { showToast } from '../../../../Actions/Toast' - -import Forward from '../../../../Library/Icons/Forward' - -import './Home.css' - -function mapStateToProps(state) { - return { - pc: state.status.pc, - - loading: state.bbs.loading, - list: state.bbs.list, - showList: state.bbs.showList, - showMore: state.bbs.showMore, - } -} - -function mapDispatchToProps(dispatch) { - return { - setNavigationTitle(title) { - dispatch(setNavigationTitle(title)) - }, - setBackNavigation(backNavigation, backNavigationPath) { - dispatch(setBackNavigation(backNavigation, backNavigationPath)) - }, - getBBSList() { - dispatch(getBBSList()) - }, - - showToast(string) { - dispatch(showToast(string)) - }, - loadMore() { - dispatch(loadMore()) - }, - } -} - -class Home extends Component { - componentDidMount() { - this.props.setNavigationTitle('会員専用掲示板') - this.props.setBackNavigation(true, '/') - this.props.getBBSList() - } - - // loadMore () { - // setTimeout(() => { - // const showCount = this.state.showCount + 5 - // const bbsList = this.state.bbsList.concat(this.props.list.list.slice(this.state.showCount, showCount)) - // console.log('load call', this.state.showCount, showCount, bbsList, showCount, this.props.list.list.length) - // this.setState({bbsList, showCount}) - // if (showCount > this.props.list.list.length) this.setState({hasMore: false}) - // }, 100) - // } - - renderContents() { - if (this.props.loading || !this.props.list) - return ( -
    -
    -
    -
    -
    - ) - return this.props.showList.map((each, i) => { - const text = each.text - .replace(/(
    |
    )/gi, '\n') - .replace(/>/gi, '>') - .replace(/</gi, '<') - return ( -
    -
    - {each.number} - {each.name} - {each.time} -
    - {/*
    */} -
    - {text.split('\n').map((m, j) => { - return

    {m}

    - })} -
    -
    - ) - }) - } - - renderMore() { - if (this.props.loading || !this.props.list) return false - return this.props.showMore ? ( -
    this.props.loadMore()} className="more"> - More -
    - ) : ( - false - ) - } - - render() { - const showList = this.renderContents() - const showMore = this.renderMore() - - return ( - -
    -
    - ホーム - - 掲示板 -
    -

    会員専用掲示板

    -
    - -
    -
    -
      -
    • - -
      - 書き込む - -
      - -
    • -
    -
    -
    - -
    -
    -
    - {showList} - {showMore} -
    -
    -
    - -
    -
    -
      -
    • - -
      - 書き込む - -
      - -
    • -
    -
    -
    - - {/* */} -
    - ) - } -} - -export default connect(mapStateToProps, mapDispatchToProps)(Home) diff --git a/client/src/Component/Auth/BBS/Home/Home.scss b/client/src/Component/Auth/BBS/Home/Home.scss deleted file mode 100644 index 38191b68..00000000 --- a/client/src/Component/Auth/BBS/Home/Home.scss +++ /dev/null @@ -1,136 +0,0 @@ -.bbs { - width: 100%; - // max-width: 600px; - margin: 0 auto; - // font-size: 13px; - - // background: #fff; - - // &.pc { - // .contents-header { - // h2 { - // padding: 0 16px; - // } - // } - // } - - // .contents-header { - // margin: 0; - // padding: 16px 0; - // background: #fff; - - // h2 { - // padding: 0 12px; - // font-size: 16px; - // font-weight: normal; - // } - // } - - .bbs-list { - .bbs-item { - padding: 12px; - & { - background: #f6f6f6; - } - @media (prefers-color-scheme: dark) { - & { - background: #333; - } - } - - &:not(:first-child) { - margin-top: 12px; - } - - .bbs-title { - display: flex; - align-items: center; - - .number { - min-width: 20px; - min-height: 20px; - border-radius: 5px; - padding: 4px 6px; - text-align: center; - line-height: 20px; - font-size: 1em; - font-weight: bold; - - & { - background: rgba(150, 150, 150, 1); - color: rgba(255, 255, 255, 1); - } - @media (prefers-color-scheme: dark) { - & { - background: rgba(80, 80, 80, 1); - color: rgba(150, 150, 150, 1); - } - } - } - - .name { - padding-left: 8px; - font-size: 0.8rem; - } - - .time { - margin-left: auto; - font-size: 0.8rem; - color: #aaa; - } - } - - .bbs-text { - margin-top: 8px; - font-size: 0.9rem; - - p { - margin: 0; - padding: 0; - } - } - } - - .more { - margin: 12px 0 0; - padding: 12px 0; - font-size: 13px; - text-align: center; - text-transform: uppercase; - cursor: pointer; - - & { - color: #333; - &:hover { - color: #666; - i { - color: #666; - } - } - i { - color: #666; - } - } - @media (prefers-color-scheme: dark) { - & { - color: #ccc; - &:hover { - color: #eee; - i { - color: #eee; - } - } - i { - color: #aaa; - } - } - } - - i { - display: block; - - font-size: 18px; - } - } - } -} diff --git a/client/src/Component/Auth/BBS/Post/Post.js b/client/src/Component/Auth/BBS/Post/Post.js deleted file mode 100644 index 1ae99a72..00000000 --- a/client/src/Component/Auth/BBS/Post/Post.js +++ /dev/null @@ -1,145 +0,0 @@ -import React, { Component } from 'react' -import { Link } from 'react-router-dom' - -import { connect } from 'react-redux' - -import Back from '../../../../Library/Icons/Back' -import * as lib from '../../../../Library/Library' - -import { setNavigationTitle, setBackNavigation } from '../../../../Actions/Navigation' -import { setPostName, setPostText, setPostPass, sendPost, resetPost } from '../../../../Actions/BBS' - -import './Post.css' - -function mapStateToProps(state) { - return { - pc: state.status.pc, - - postName: state.bbs.postName, - postText: state.bbs.postText, - postPass: state.bbs.postPass, - - loadingPost: state.bbs.loadingPost, - } -} - -function mapDispatchToProps(dispatch) { - return { - setNavigationTitle(title) { - dispatch(setNavigationTitle(title)) - }, - setBackNavigation(backNavigation, backNavigationPath) { - dispatch(setBackNavigation(backNavigation, backNavigationPath)) - }, - setPostName(postName) { - dispatch(setPostName(postName)) - }, - setPostText(postText) { - dispatch(setPostText(postText)) - }, - setPostPass(postPass) { - dispatch(setPostPass(postPass)) - }, - sendPost() { - dispatch(sendPost()) - }, - resetPost() { - dispatch(resetPost()) - }, - } -} - -class Post extends Component { - componentDidMount() { - this.props.setNavigationTitle('書き込む') - this.props.setBackNavigation(true, '/bbs') - } - - // loadMore () { - // setTimeout(() => { - // const showCount = this.state.showCount + 5 - // const bbsList = this.state.bbsList.concat(this.props.list.list.slice(this.state.showCount, showCount)) - // console.log('load call', this.state.showCount, showCount, bbsList, showCount, this.props.list.list.length) - // this.setState({bbsList, showCount}) - // if (showCount > this.props.list.list.length) this.setState({hasMore: false}) - // }, 100) - // } - - render() { - return ( - -
    -
    - ホーム - - 掲示板 - - 書き込む -
    -

    書き込む

    -
    - -
    -
    -
    - - this.props.setPostName(e.target.value)} - /> -
    -
    - -