Skip to content

Commit

Permalink
Feat: Format the code with prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
whats2000 committed Oct 12, 2024
1 parent 9d4596c commit 65f864e
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 20 deletions.
20 changes: 12 additions & 8 deletions app/src/components/SelectorSetting/AllCourse.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ class AllCourse extends Component {
applyTextFilter = (course, filterName, filter) => {
// console.log(filter);
const courseValue = course[courseDataNameMap[filterName]]?.toLowerCase();
const filterLogic = filter.filterLogic === undefined ? 'include' : filter.filterLogic; // equal, include, exclude
const filterLogic =
filter.filterLogic === undefined ? 'include' : filter.filterLogic; // equal, include, exclude
// 使用逗號或空格分割每個組
const filterGroups = filter.value.toLowerCase().split(/[,]/);

Expand Down Expand Up @@ -184,7 +185,8 @@ class AllCourse extends Component {
*/
applyTimeFilter = (course, filterName, filter) => {
// 檢查是否包含或排除
const filterLogic = filter.filterLogic === undefined ? 'include' : filter.filterLogic;
const filterLogic =
filter.filterLogic === undefined ? 'include' : filter.filterLogic;

if (filterName === '星期') {
if (filterLogic !== 'equal') {
Expand All @@ -193,15 +195,13 @@ class AllCourse extends Component {
return filter[day] && course[day];
});
return filterLogic === 'include' ? daysMatched : !daysMatched;
}
else {
} else {
// 檢查是否有所有天匹配
const daysMatched = courseDayName.every((day) => {
return (filter[day] === true) === (course[day] !== '');
});
return daysMatched;
}

}

if (filterName === '節次') {
Expand All @@ -218,11 +218,15 @@ class AllCourse extends Component {
}
});
return filterLogic === 'include' ? periodsMatched : !periodsMatched;
}
else {
} else {
// 檢查是否有所有節次匹配
let periodsMatched = true;
let filterPeriods = Object.keys(filter).filter((key) => key !== 'active' && key !== 'filterLogic' && filter[key]).sort().join('');
let filterPeriods = Object.keys(filter)
.filter(
(key) => key !== 'active' && key !== 'filterLogic' && filter[key],
)
.sort()
.join('');
// console.log(filterPeriods);
courseDayName.forEach((day) => {
if (course[day]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ class FilterRow extends Component {
// 創建一個新的選中狀態對象,將所有選項設為選中
const selected = {
active: this.props.advancedFilters[filterName]?.active ?? false,
filterLogic: this.props.advancedFilters[filterName]?.filterLogic ?? 'include',
filterLogic:
this.props.advancedFilters[filterName]?.filterLogic ?? 'include',
};
this.props.filterOptions[filterName].options.forEach((option) => {
selected[option] = true;
Expand All @@ -159,7 +160,8 @@ class FilterRow extends Component {
...this.props.advancedFilters,
[filterName]: {
active: this.props.advancedFilters[filterName]?.active ?? false,
filterLogic: this.props.advancedFilters[filterName]?.filterLogic ?? 'include',
filterLogic:
this.props.advancedFilters[filterName]?.filterLogic ?? 'include',
},
};

Expand Down Expand Up @@ -261,7 +263,9 @@ class FilterRow extends Component {
{
Object.keys(selected).filter(
(key) =>
key !== 'active' && key !== 'filterLogic' && selected[key],
key !== 'active' &&
key !== 'filterLogic' &&
selected[key],
).length
}{' '}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function ListInformation({

const handleCloseOrderElement = () => setShow(false);
const handleToggleOrderElement = () => setShow(!show);

// const handleShowSelectedCourses = () => {
// setDisplayConflictCourses(prevState => !prevState);
// };
Expand Down
4 changes: 1 addition & 3 deletions app/src/components/TermofUse.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ class TermofUse extends Component {
</TextWithIcon>
</Modal.Title>
</Modal.Header>
<Modal.Body>
testestestestsestsetsetsetset
</Modal.Body>
<Modal.Body>testestestestsestsetsetsetset</Modal.Body>
<Modal.Footer>
<Button variant='secondary' onClick={this.handleClose}>
關閉
Expand Down
36 changes: 31 additions & 5 deletions app/src/config.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,18 @@ export const announcementData = {
<a href='https://github.com/whats2000/NSYSUCourseAPI'>中山課程開放API</a>
</>,
],
termsofuse: [<>當您使用本網站時,即表示您同意<a href='https://github.com/CelleryLin/selector_helper/blob/main/term_of_use.md' target='_blank' rel='noreferrer noopener'>使用條款</a></>],
termsofuse: [
<>
當您使用本網站時,即表示您同意
<a
href='https://github.com/CelleryLin/selector_helper/blob/main/term_of_use.md'
target='_blank'
rel='noreferrer noopener'
>
使用條款
</a>
</>,
],
githubUrl: 'https://github.com/CelleryLin/selector_helper/',
contactEmail: '[email protected]',
copyright: [
Expand All @@ -64,12 +75,27 @@ export const announcementData = {

export const entryNotificationConfig = {
version: announcementData.version,
description:
description: (
<>
我們已更新使用條款,當您使用本網站時,即表示您同意
<a href='https://github.com/CelleryLin/selector_helper/blob/main/term_of_use.md' target='_blank' rel='noreferrer noopener'>使用條款</a>
</>,
updates: [<a href='https://github.com/CelleryLin/selector_helper/blob/main/term_of_use.md' target='_blank' rel='noreferrer noopener'>使用條款</a>],
<a
href='https://github.com/CelleryLin/selector_helper/blob/main/term_of_use.md'
target='_blank'
rel='noreferrer noopener'
>
使用條款
</a>
</>
),
updates: [
<a
href='https://github.com/CelleryLin/selector_helper/blob/main/term_of_use.md'
target='_blank'
rel='noreferrer noopener'
>
使用條款
</a>,
],
feedbackFormUrl: announcementData.feedbackFormUrl,
};

Expand Down

0 comments on commit 65f864e

Please sign in to comment.