mirror of
https://github.com/mastodon/mastodon.git
synced 2025-05-15 06:01:12 +00:00
修改了reducer,action,container。出现错误,无法加载css,json parse error
This commit is contained in:
parent
6f83b7cb91
commit
056db885d1
|
@ -81,6 +81,8 @@ export const COMPOSE_CHANGE_MEDIA_ORDER = 'COMPOSE_CHANGE_MEDIA_ORDER';
|
||||||
export const COMPOSE_SET_STATUS = 'COMPOSE_SET_STATUS';
|
export const COMPOSE_SET_STATUS = 'COMPOSE_SET_STATUS';
|
||||||
export const COMPOSE_FOCUS = 'COMPOSE_FOCUS';
|
export const COMPOSE_FOCUS = 'COMPOSE_FOCUS';
|
||||||
|
|
||||||
|
export const COMPOSE_CHANGE_IS_SCHEDULED = 'COMPOSE_CHANGE_IS_SCHEDULED';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
uploadErrorLimit: { id: 'upload_error.limit', defaultMessage: 'File upload limit exceeded.' },
|
uploadErrorLimit: { id: 'upload_error.limit', defaultMessage: 'File upload limit exceeded.' },
|
||||||
uploadErrorPoll: { id: 'upload_error.poll', defaultMessage: 'File upload not allowed with polls.' },
|
uploadErrorPoll: { id: 'upload_error.poll', defaultMessage: 'File upload not allowed with polls.' },
|
||||||
|
@ -835,3 +837,9 @@ export const changeMediaOrder = (a, b) => ({
|
||||||
a,
|
a,
|
||||||
b,
|
b,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export function changeIsScheduled() {
|
||||||
|
return {
|
||||||
|
type: COMPOSE_IS_SCHEDULED_CHANGE,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -71,6 +71,11 @@ class ComposeForm extends ImmutablePureComponent {
|
||||||
singleColumn: PropTypes.bool,
|
singleColumn: PropTypes.bool,
|
||||||
lang: PropTypes.string,
|
lang: PropTypes.string,
|
||||||
maxChars: PropTypes.number,
|
maxChars: PropTypes.number,
|
||||||
|
|
||||||
|
schedule_time: PropTypes.string,
|
||||||
|
schedule_timezone: PropTypes.string,
|
||||||
|
is_scheduled: PropTypes.bool.isRequired,
|
||||||
|
scheduled_at: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
|
@ -312,6 +317,7 @@ class ComposeForm extends ImmutablePureComponent {
|
||||||
<div>
|
<div>
|
||||||
<label>计划时间(UTC)</label>
|
<label>计划时间(UTC)</label>
|
||||||
<input
|
<input
|
||||||
|
className='search__input'
|
||||||
type='datetime-local'
|
type='datetime-local'
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,31 +1,26 @@
|
||||||
import { injectIntl,defineMessages } from "react-intl";
|
import { injectIntl, defineMessages } from "react-intl";
|
||||||
|
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
|
|
||||||
import ScheduleIcon from '@/material-icons/400-20px/schedule.svg?react';
|
import ScheduleIcon from '@/material-icons/400-20px/schedule.svg?react';
|
||||||
import { IconButton } from "@/mastodon/components/icon_button";
|
import { IconButton } from "@/mastodon/components/icon_button";
|
||||||
|
|
||||||
|
import { changeIsScheduled } from '../../actions/compose';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const mapStateToProps = (state) => ({
|
||||||
const mapStateToProps = () => ({
|
|
||||||
iconComponent: ScheduleIcon,
|
iconComponent: ScheduleIcon,
|
||||||
title: defineMessages({
|
title: 'schedule',
|
||||||
title: {
|
active: state.getIn(['compose', 'is_scheduled']),
|
||||||
id: 'compose.schedule_button.title',
|
|
||||||
defaultMessage: 'Schedule',
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
active: false,
|
|
||||||
ariaControls: 'schedule-compose-form',
|
|
||||||
size: 18,
|
size: 18,
|
||||||
inverted: true,
|
inverted: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => ({
|
const mapDispatchToProps = dispatch => ({
|
||||||
onClick () {
|
onClick () {
|
||||||
dispatch({ type: 'SCHEDULE_COMPOSE' });
|
dispatch(changeIsScheduled());
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ import {
|
||||||
COMPOSE_CHANGE_MEDIA_ORDER,
|
COMPOSE_CHANGE_MEDIA_ORDER,
|
||||||
COMPOSE_SET_STATUS,
|
COMPOSE_SET_STATUS,
|
||||||
COMPOSE_FOCUS,
|
COMPOSE_FOCUS,
|
||||||
|
COMPOSE_CHANGE_IS_SCHEDULED,
|
||||||
} from '../actions/compose';
|
} from '../actions/compose';
|
||||||
import { REDRAFT } from '../actions/statuses';
|
import { REDRAFT } from '../actions/statuses';
|
||||||
import { STORE_HYDRATE } from '../actions/store';
|
import { STORE_HYDRATE } from '../actions/store';
|
||||||
|
@ -94,6 +95,11 @@ const initialState = ImmutableMap({
|
||||||
focusY: 0,
|
focusY: 0,
|
||||||
dirty: false,
|
dirty: false,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
schedule_time: new Date().toLocaleString('zh-CN').split('/').join('-').split(' ').join('T')+'.0',
|
||||||
|
schedule_timezone: new Date().getTimezoneOffset() > 0?'-':'+' + (0 - new Date().getTimezoneOffset() / 60) + ':' + ((0 - new Date().getTimezoneOffset() % 60) === 30 ? '30' :'00'),
|
||||||
|
is_scheduled: false,
|
||||||
|
scheduled_at: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
const initialPoll = ImmutableMap({
|
const initialPoll = ImmutableMap({
|
||||||
|
@ -560,6 +566,12 @@ export default function compose(state = initialState, action) {
|
||||||
|
|
||||||
return list.splice(indexA, 1).splice(indexB, 0, moveItem);
|
return list.splice(indexA, 1).splice(indexB, 0, moveItem);
|
||||||
});
|
});
|
||||||
|
case COMPOSE_CHANGE_IS_SCHEDULED:
|
||||||
|
return state.withMutations(map => {
|
||||||
|
map.set('is_scheduled', !state.get('is_scheduled'));
|
||||||
|
map.set('scheduled_at', state.get('schedule_time') + state.get('schedule_timezone'));
|
||||||
|
map.set('idempotencyKey', uuid());
|
||||||
|
});
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user