New: Change PastDays and FutureDays for ICal Feed in UI

Makes #817 easy
pull/6/head
Qstick 6 years ago
parent 5c81f12136
commit b3a20e9e0b

@ -17,8 +17,8 @@ import ModalFooter from 'Components/Modal/ModalFooter';
function getUrls(state) { function getUrls(state) {
const { const {
unmonitored, unmonitored,
premieresOnly, pastDays,
asAllDay, futureDays,
tags tags
} = state; } = state;
@ -28,19 +28,11 @@ function getUrls(state) {
icalUrl += 'unmonitored=true&'; icalUrl += 'unmonitored=true&';
} }
if (premieresOnly) {
icalUrl += 'premieresOnly=true&';
}
if (asAllDay) {
icalUrl += 'asAllDay=true&';
}
if (tags.length) { if (tags.length) {
icalUrl += `tags=${tags.toString()}&`; icalUrl += `tags=${tags.toString()}&`;
} }
icalUrl += `apikey=${window.Lidarr.apiKey}`; icalUrl += `pastDays=${pastDays}&futureDays=${futureDays}&apikey=${window.Lidarr.apiKey}`;
const iCalHttpUrl = `${window.location.protocol}//${icalUrl}`; const iCalHttpUrl = `${window.location.protocol}//${icalUrl}`;
const iCalWebCalUrl = `webcal://${icalUrl}`; const iCalWebCalUrl = `webcal://${icalUrl}`;
@ -61,8 +53,8 @@ class CalendarLinkModalContent extends Component {
const defaultState = { const defaultState = {
unmonitored: false, unmonitored: false,
premieresOnly: false, pastDays: 7,
asAllDay: false, futureDays: 28,
tags: [] tags: []
}; };
@ -105,8 +97,8 @@ class CalendarLinkModalContent extends Component {
const { const {
unmonitored, unmonitored,
premieresOnly, pastDays,
asAllDay, futureDays,
tags, tags,
iCalHttpUrl, iCalHttpUrl,
iCalWebCalUrl iCalWebCalUrl
@ -133,25 +125,25 @@ class CalendarLinkModalContent extends Component {
</FormGroup> </FormGroup>
<FormGroup> <FormGroup>
<FormLabel>Season Premieres Only</FormLabel> <FormLabel>Past Days</FormLabel>
<FormInputGroup <FormInputGroup
type={inputTypes.CHECK} type={inputTypes.NUMBER}
name="premieresOnly" name="pastDays"
value={premieresOnly} value={pastDays}
helpText="Only the first album from an artist will be in the feed" helpText="Days for iCal feed to look into the past"
onChange={this.onInputChange} onChange={this.onInputChange}
/> />
</FormGroup> </FormGroup>
<FormGroup> <FormGroup>
<FormLabel>Show as All-Day Events</FormLabel> <FormLabel>Future Days</FormLabel>
<FormInputGroup <FormInputGroup
type={inputTypes.CHECK} type={inputTypes.NUMBER}
name="asAllDay" name="futureDays"
value={asAllDay} value={futureDays}
helpText="Events will appear as all-day events in your calendar" helpText="Days for iCal feed to look into the future"
onChange={this.onInputChange} onChange={this.onInputChange}
/> />
</FormGroup> </FormGroup>

Loading…
Cancel
Save