Skip to content

Commit

Permalink
Merge branch 'develop' into fix-form-psevdonim
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonZelinsky authored Sep 8, 2024
2 parents 2509f4a + ab74c38 commit b8c0dc5
Show file tree
Hide file tree
Showing 16 changed files with 80 additions and 19 deletions.
1 change: 1 addition & 0 deletions src/__generated__/api-typings/models/Project.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/components/author-page/overview/overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export const AuthorOverview: React.FC<IAuthorOverview> = (props) => {
<Button
size='sm'
border='right-bottom-left'
href={`library/?festival=${item.year}&program=${item.id}`}
href={`library/?year=${item.year}&program=${item.id}`}
animation='invert'
>
{`${item.name} ${item.year}`}
Expand All @@ -222,6 +222,8 @@ export const AuthorOverview: React.FC<IAuthorOverview> = (props) => {
size="s"
border='bottom-left'
href={item.link}
target='_blank'
rel='noopener noreferrer'
icon={(
<Icon
glyph="arrow-right"
Expand Down
3 changes: 2 additions & 1 deletion src/components/donation-link/donation-link.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
border-top-right-radius: 200% 100%;
}

&:hover {
&:hover,
&.active {
&::before,
&::after {
visibility: visible;
Expand Down
5 changes: 4 additions & 1 deletion src/components/donation-link/donation-link.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import cn from 'classnames/bind';
import Link from 'next/link';
import { useRouter } from 'next/router';

import { Icon } from 'components/ui/icon';

Expand All @@ -11,10 +12,12 @@ const cx = cn.bind(styles);

export const DonationLink = (props: Pick<LinkProps, 'href'>): JSX.Element => {
const { href } = props;
const router = useRouter();
const isActive = router.asPath === href;

return (
<Link href={href}>
<a className={cx('link')}>
<a className={cx('link', { active: isActive })}>
<Icon glyph="plus" className={cx('icon')}/>
<span className={cx('text')}>
Поддержать
Expand Down
13 changes: 11 additions & 2 deletions src/components/festival-event-card/festival-event-card.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,21 @@

.actions {
display: flex;
align-items: flex-start;
justify-content: flex-end;
flex-direction: row;
align-items: stretch;
justify-content: space-between;
grid-area: actions;

@media (min-width: $tablet-portrait) {
width: fit-content;
flex-direction: column;
justify-content: flex-start;
gap: 16px;
}
}

.button {
justify-content: flex-start;
padding: 0 2px 2px 0;
}

Expand Down
34 changes: 29 additions & 5 deletions src/components/festival-event-card/festival-event-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ export interface FestivalEventCardProps {
title: string
description?: string
credits: CreditsRole[]
aboutUrl?: string
actionUrl?: Url | null
actionText?: string | null
className?: string
}

Expand All @@ -29,7 +31,9 @@ export const FestivalEventCard: React.VFC<FestivalEventCardProps> = (props) => {
title,
description,
credits,
aboutUrl,
actionUrl,
actionText,
className
} = props;

Expand Down Expand Up @@ -73,8 +77,27 @@ export const FestivalEventCard: React.VFC<FestivalEventCardProps> = (props) => {
className={cx('credits')}
roles={credits}
/>
{actionUrl && (
<div className={cx('actions')}>
<div className={cx('actions')}>
{aboutUrl && (
<Button
size="s"
border="bottom-left"
icon={(
<Icon
glyph="arrow-right"
width="100%"
height="100%"
/>
)}
href={aboutUrl}
className={cx('button')}
target="_blank"
upperCase
>
О спектакле
</Button>
)}
{actionUrl && actionText && (
<Button
size="s"
border="bottom-left"
Expand All @@ -90,10 +113,11 @@ export const FestivalEventCard: React.VFC<FestivalEventCardProps> = (props) => {
target="_blank"
upperCase
>
Регистрация
{actionText}
</Button>
</div>
)}
)}
</div>

</article>
);
};
2 changes: 2 additions & 0 deletions src/components/festival-schedule/festival-schedule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ export const FestivalSchedule: React.VFC<FestivalScheduleProps> = withSWRFallbac
title={event.title}
image={event.artworkUrl}
description={event.description}
aboutUrl={event.performanceId !== null ? (`/performances/${event.performanceId}`) : undefined}
actionUrl={event.registrationUrl}
actionText={event.actionText}
credits={event.team}
/>
))}
Expand Down
3 changes: 3 additions & 0 deletions src/components/history-page/title/history-title-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export const HistoryTitleCard = ({ item }: {item: ICard}) => {
type='button'
size='xxl'
border='none'
className={cn({
[style.buttonDefault]: !item.buttonProps,
})}
{...(item.count && item.buttonProps)}
>
{item.count ? item.count.toString() : '0'}
Expand Down
4 changes: 4 additions & 0 deletions src/components/history-page/title/history-title.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@
display: flex;
}

.buttonDefault {
cursor: default;
}

.button.link.subtitle {
overflow: hidden;
padding: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@ import { ProjectLayoutStorey } from '../storey';
import styles from './project-layout-description.module.css';

interface IProjectLayoutDescriptionProps {
children: string
descriptionCaption: string
description: string
}

const cx = classNames.bind(styles);

export const ProjectLayoutDescription = ({ children }: IProjectLayoutDescriptionProps): JSX.Element => {
export const ProjectLayoutDescription = ({ descriptionCaption, description }: IProjectLayoutDescriptionProps): JSX.Element => {

return (
<ProjectLayoutStorey type="description">
<section>
<h2 className={cx('title')}>
О проекте
{descriptionCaption}
</h2>
<p className={cx('text')}>
{children}
{description}
</p>
</section>
</ProjectLayoutStorey>
Expand Down
1 change: 1 addition & 0 deletions src/core/project/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export type Project = {
export type ProjectDetailed = {
title: string
intro: string
descriptionCaption: string
description: string
image: string
contents: BaseContent[]
Expand Down
2 changes: 2 additions & 0 deletions src/core/schedule/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ export type FestivalEvent = {
date: DateTimeIsoString
registrationOpeningDate: DateTimeIsoString
registrationUrl?: Url | null
actionText: string | null
performanceId: number | null
}
10 changes: 8 additions & 2 deletions src/pages/form/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ const validate = (values: ParticipationFormFields) => {

const Participation = () => {
const [errorOccurred, setErrorOccurred] = useState(false);
const [requestActive, setRequestActive] = useState(false);
const form = useForm<ParticipationFormFields>({
initialValues: initialFormValues,
validate: validate,
Expand Down Expand Up @@ -196,13 +197,16 @@ const Participation = () => {
return;
}
try {
setRequestActive(true);
const participationData = form.values.anonym === false ? { ...form.values, nickname: '' } : form.values;
await postParticipation(participationData);
router.push('/form/success');
} catch (error) {
handleSubmitError(error);

return;
} finally {
setRequestActive(false);
}
};

Expand Down Expand Up @@ -401,9 +405,11 @@ const Participation = () => {
border="full"
upperCase
fullWidth
disabled={!canSubmit}
disabled={!canSubmit || requestActive}
>
Отправить
{
requestActive ? 'Отправляется' : 'Отправить'
}
</Button>
</Form.Actions>
<Form.Disclaimer>
Expand Down
5 changes: 2 additions & 3 deletions src/pages/projects/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const Project = (props: InferGetServerSidePropsType<typeof getServerSideProps>)
const {
title,
intro,
descriptionCaption,
description,
image,
contents,
Expand All @@ -39,9 +40,7 @@ const Project = (props: InferGetServerSidePropsType<typeof getServerSideProps>)
intro={intro}
image={image}
/>
<ProjectLayout.Description>
{description}
</ProjectLayout.Description>
<ProjectLayout.Description {...{ descriptionCaption, description }}/>
<ConstructorContent
variant="project"
// @ts-expect-error: TODO: В документации API нет описания ответов с блоками конструктора
Expand Down
1 change: 1 addition & 0 deletions src/services/api/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function mapDTOtoProjectDetailed(dto: ProjectDTO): ProjectDetailed {
title: dto.title,
intro: dto.intro,
description: dto.description,
descriptionCaption: dto.description_caption,
image: dto.image,
contents: dto.contents,
};
Expand Down
2 changes: 2 additions & 0 deletions src/services/api/schedule-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ function mapDTOToFestivalEvents(dto: EventsDTO): PaginatedFestivalEvents {
date: event.date_time,
registrationOpeningDate: event.opening_date_time,
registrationUrl: event.action_url,
actionText: event.action_text,
performanceId: event.performance_id
})),
pagination,
};
Expand Down

0 comments on commit b8c0dc5

Please sign in to comment.