Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/dankozz1t/KidsLike into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
dankozz1t committed Oct 15, 2022
2 parents cd7674c + 2d1fbba commit 044afb9
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/modules/WeekTabContent/WeekTabContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useMediaQuery } from 'react-responsive';

const WeekTabContent = ({ selectedDate }) => {
const tasks = useSelector(state => getDaysTasks(state, selectedDate));
const isTablet = useMediaQuery({maxWidth: 1279, minWidth: 768})
const isTablet = useMediaQuery({ maxWidth: 1279, minWidth: 768 });
return (
<div className={s.wrapper}>
<div className={s.wrapper__header}>
Expand Down
3 changes: 1 addition & 2 deletions src/modules/WeekTabContent/WeekTabContent.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@
@include media(tablet) {
padding: 0 32px;
}
@include media(desktop){
@include media(desktop) {
padding: 0px 16px 0 107px;
}

}
13 changes: 8 additions & 5 deletions src/modules/WeekTabs/WeekTabs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ import s from './WeekTabs.module.scss';

const WeekTabs = ({ weekDays }) => {
const isDesktop = useMediaQuery({ minWidth: 1280 });
const isTablet = useMediaQuery({maxWidth: 1279, minWidth: 768})
const isTablet = useMediaQuery({ maxWidth: 1279, minWidth: 768 });
const currentWeekDay = new Date().toLocaleString('en-US', {
weekday: 'long',
});

const [searchParams, setSearchParams] = useSearchParams();
const [selectedRadio, setSelectedRadio] = useState(searchParams.get('day') || currentWeekDay );

const [selectedRadio, setSelectedRadio] = useState(
searchParams.get('day') || currentWeekDay
);

const isRadioSelected = value => selectedRadio === value;

Expand All @@ -34,7 +35,7 @@ const WeekTabs = ({ weekDays }) => {

return (
<div className={s.box}>
{isTablet && <CurrentWeekRange/>}
{isTablet && <CurrentWeekRange />}
<ul className={s.weekTabs}>
{weekDays.map(day => (
<li className={s.weekTabs__item} key={day}>
Expand All @@ -48,7 +49,9 @@ const WeekTabs = ({ weekDays }) => {
className={s.weekTabs__input}
/>
<label htmlFor={day} className={s.weekTabs__label}>
<span className={s.weekTabs__name}>{isDesktop ? day : day.slice(0, 2)}</span>
<span className={s.weekTabs__name}>
{isDesktop ? day : day.slice(0, 2)}
</span>
</label>
</li>
))}
Expand Down
7 changes: 2 additions & 5 deletions src/modules/WeekTabs/WeekTabs.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
@media screen and (max-width: 319px) {
width: 100%;
}
}
@include media(tablet) {
justify-content: space-between;
align-items: baseline;
Expand All @@ -34,7 +34,6 @@
width: 269px;
}


@include media(tablet) {
margin: 0;
width: 376px;
Expand Down Expand Up @@ -76,7 +75,6 @@
}

.weekTabs__label {

display: flex;
align-items: center;
justify-content: flex-start;
Expand All @@ -97,7 +95,6 @@
text-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
}


@include media(mobile-only) {
width: 35px;
height: 24px;
Expand All @@ -107,7 +104,7 @@
@media screen and (max-width: 319px) {
width: 32px;
height: 24px;
}
}

@include media(tablet) {
width: 40px;
Expand Down
3 changes: 1 addition & 2 deletions src/pages/PlanningPage/PlanningPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ import PlanningPoints from 'shared/components/PlanningPoints/PlanningPoints';
const PlanningPage = () => {
const tasks = useSelector(getAllTasks, shallowEqual);


return (
<>
<PlanningPoints />

<div className={s.cards_wrapper}>
<CardsList tasks={tasks} />
</div>
Expand Down
4 changes: 1 addition & 3 deletions src/pages/PlanningPage/PlanningPage.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
margin-left: auto;
margin-right: auto;


padding-bottom: 0;

@include media(desktop) {
width: 1248px;
padding-bottom: 27px;
}

}
}
1 change: 1 addition & 0 deletions src/redux/auth/auth.selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const selectAuthUser = state => state.auth;
export const getLoggedIn = state => state.auth.status;
export const getToken = state => state.auth.token;


export const getUser = state => state.auth.user;

export const selectStartWeekDate = state => state?.auth?.week?.startWeekDate;
Expand Down
2 changes: 1 addition & 1 deletion src/redux/gift/gift.initial-state.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const taskInitialState = {
gifts: [],
boughtGiftsIds: [],
isLoading: false
isLoading: false,
};

export default taskInitialState;
2 changes: 1 addition & 1 deletion src/redux/gift/gift.selector.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const isLoadingGift = state => state.gift.isLoading;
export const getGifts = state => state.gift.gifts;
export const getBoughtGiftsIds = state => state.gift.boughtGiftsIds;
export const getBoughtGiftsIds = state => state.gift.boughtGiftsIds;
12 changes: 7 additions & 5 deletions src/redux/gift/gift.thunk.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,28 @@ import { getGiftsService, buyGiftsService } from 'shared/service/gift.service';
import { token } from 'shared/service/http/http';

export const getGiftsThunk = createAsyncThunk(
'gift/getGifts', async (_, { rejectWithValue, getState }) => {
'gift/getGifts',
async (_, { rejectWithValue, getState }) => {
try {
const currentToken = getState().auth.token;
token.set(currentToken);
const resp = await getGiftsService();
return resp.data.ruGifts;
} catch (e) {
return rejectWithValue();
};
}
}
);

export const buyGiftsThunk = createAsyncThunk(
'gift/buyGifts', async (body, { rejectWithValue }) => {
'gift/buyGifts',
async (body, { rejectWithValue }) => {
try {
const resp = await buyGiftsService(body);
const { updatedBalance, purchasedGiftIds } = resp.data;
return { updatedBalance, purchasedGiftIds };
} catch (e) {
return rejectWithValue();
};
}
}
);
);
12 changes: 6 additions & 6 deletions src/shared/components/CardBody/CardBody.module.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.card__image {
object-fit: cover;
display: block;
border-radius: 6px 6px 0px 0px;
width: 100%;
height: 194px;
}
object-fit: cover;
display: block;
border-radius: 6px 6px 0px 0px;
width: 100%;
height: 194px;
}
2 changes: 1 addition & 1 deletion src/shared/components/CardsList/CardsList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const CardsList = ({ tasks }) => {
{tasks.map(task => {
let id;
task.id ? (id = task.id) : (id = task._id);

return (
<li key={id} className={s.card_item}>
<Card {...task} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import modalEditInput from 'assets/images/modal-image/edit-24px 2.svg';
import s from './ModalContentCreateTask.module.scss';
import { toast } from 'react-toastify';


const ModalContentCreateTask = () => {
const dispatch = useDispatch();
const imageInputRef = useRef(null);
Expand Down
2 changes: 1 addition & 1 deletion src/shared/service/gift.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export const getGiftsService = async () => {

export const buyGiftsService = async body => {
return await privateApi.patch('/gift', body);
};
};

0 comments on commit 044afb9

Please sign in to comment.