Skip to content

Commit 57d3626

Browse files
authored
Merge pull request #957 from aisaenok/issues-878
878: Added a new widget Communities.
2 parents b327424 + 85deabc commit 57d3626

File tree

10 files changed

+175
-19
lines changed

10 files changed

+175
-19
lines changed

FirstPR.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

firstPR.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

frontend/src/app/providers/i18n/locales/en.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
export default {
22
translation: {
3+
communities: {
4+
action_connect_to: 'Присоединиться к сообществу',
5+
anchor: 'Сообщество',
6+
description: 'Мы объединяем выпускников и участников: общение, обмен опытом, поддержка и совместные проекты.',
7+
link_bot_title: 'Бот Карьеры',
8+
link_bot_description: 'Автотесты, подсказки по откликам, сопровождение поиска.',
9+
link_channel_hexlet_title: 'Телеграм канал Хекслета',
10+
link_channel_hexlet_description: 'Анонсы, инсайты, советы по карьере и обучению.',
11+
link_channel_vacancies_title: 'Канал вакансии для новичков',
12+
link_channel_vacancies_description: 'Свежие джуниор-вакансии и стажировки каждый день.',
13+
title: 'Наше сообщество',
14+
},
315
homePage: {
416
greetings: 'Welcome',
517
aboutUs: {

frontend/src/app/providers/i18n/locales/ru.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
export default {
22
translation: {
3+
communities: {
4+
action_connect_to: 'Присоединиться к сообществу',
5+
anchor: 'Сообщество',
6+
description: 'Мы объединяем выпускников и участников: общение, обмен опытом, поддержка и совместные проекты.',
7+
link_bot_title: 'Бот Карьеры',
8+
link_bot_description: 'Автотесты, подсказки по откликам, сопровождение поиска.',
9+
link_channel_hexlet_title: 'Телеграм канал Хекслета',
10+
link_channel_hexlet_description: 'Анонсы, инсайты, советы по карьере и обучению.',
11+
link_channel_vacancies_title: 'Канал вакансии для новичков',
12+
link_channel_vacancies_description: 'Свежие джуниор-вакансии и стажировки каждый день.',
13+
title: 'Наше сообщество',
14+
},
315
homePage: {
416
greetings: 'Добро пожаловать!',
517
aboutUs: {

frontend/src/app/providers/ui/ui.provider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import '@mantine/core/styles.css'
33

44
export const UIProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
55
return (
6-
<MantineProvider>
6+
<MantineProvider defaultColorScheme="dark">
77
{ children }
88
</MantineProvider>
99
)

frontend/src/pages/Home.tsx

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ import {
1313
} from '@mantine/core'
1414
import { Footer } from '@widgets/Footer'
1515
import { Header } from '@widgets/Header'
16-
import { AboutUs } from '@widgets/about-us';
17-
import { WhoWeAre } from '@widgets/who-we-are';
16+
import { AboutUs } from '@widgets/about-us'
17+
import { WhoWeAre } from '@widgets/who-we-are'
18+
import { Communities } from '@widgets/communities'
1819

1920
type PageSection = {
2021
id: number
@@ -33,7 +34,15 @@ type IndexProps = {
3334

3435
// Компонент-пустышка для демонстрации пропса pageSections (Потом УДАЛИТЬ!)
3536
const sample: JSX.Element = (
36-
<SimpleGrid cols={2} spacing="xs" bg={alpha('#787878', 0.2)} p="xl" bdrs="lg" bd={'1px solid ' + alpha('#FFFFFF', 0.1)} my={20}>
37+
<SimpleGrid
38+
cols={2}
39+
spacing="xs"
40+
bg={alpha('#787878', 0.2)}
41+
p="xl"
42+
bdrs="lg"
43+
bd={'1px solid ' + alpha('#FFFFFF', 0.1)}
44+
my={20}
45+
>
3746
<Stack gap="md" align="strech">
3847
<Title order={1} c="white" fw={700}>
3948
Привет, мы Хекслет
@@ -88,30 +97,27 @@ const Index: React.FC<IndexProps> = ({ pageSections }) => {
8897
const repeatCount = 5 // Колличество повторений примера inertia компонента
8998
const repeatedSamples: React.ReactNode[] = []
9099
for (let i = 0; i < repeatCount; i++) {
91-
repeatedSamples.push(
92-
<div key={i}>
93-
{sample}
94-
</div>
95-
)
100+
repeatedSamples.push(<div key={i}>{sample}</div>)
96101
}
97102
// Конец компонента-пустышки
98103

99104
return (
100105
<Stack
101106
// mih="100vh"
102-
bg={getGradient({
103-
deg: 135,
104-
from: 'black',
105-
to: '#00031a',
106-
}, theme)}
107-
justify="space-between"
107+
bg={getGradient({
108+
deg: 135,
109+
from: 'black',
110+
to: '#00031a',
111+
}, theme)}
112+
justify="space-between"
108113
>
109114
<Header />
110115
{/* здесь передаем пропсы страниц для отрисовки, а пока БД пустая я сделал компонент пустышку для демонстрации */}
111116
<Container size="xl">
112-
<AboutUs/>
113-
<WhoWeAre/>
117+
<AboutUs />
118+
<WhoWeAre />
114119
{repeatedSamples}
120+
<Communities />
115121
</Container>
116122
<Footer />
117123
</Stack>
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import { Badge, Button, Center, Container, SimpleGrid, Space, Text, Title } from '@mantine/core'
2+
import { useTranslation } from 'react-i18next'
3+
import { TelegramLink } from './components/TelegramLink'
4+
import { openTelegramLink } from './helpers/openTelegramInNewTab'
5+
6+
const TG_USERNAME_HEXLET_CAREER_BOT = 'HexletCareerBot'
7+
const TG_USERNAME_HEXLET_RU = 'hexlet_ru'
8+
const TG_USERNAME_HEXLET_JUNIOR_VACANCIES = 'junior_vacancies'
9+
10+
const SIMPLE_GRID_COLS_CONFIG = { base: 1,
11+
sm: 2,
12+
md: 3 }
13+
14+
export const Communities: React.FC = () => {
15+
const { t } = useTranslation()
16+
17+
return (
18+
<Container size="lg" py="xl">
19+
<Center>
20+
<Badge
21+
color="violet"
22+
fz="xs"
23+
radius="xl"
24+
size="lg"
25+
variant="light"
26+
tt="none"
27+
styles={{
28+
root: {
29+
fontWeight: 'normal',
30+
},
31+
}}
32+
>
33+
{t('communities.anchor')}
34+
</Badge>
35+
</Center>
36+
<Space h="md" />
37+
<Center>
38+
<Title c="white" order={1}>
39+
{t('communities.title')}
40+
</Title>
41+
</Center>
42+
<Center>
43+
<Text c="white">{t('communities.description')}</Text>
44+
</Center>
45+
<Space h="md" />
46+
<SimpleGrid cols={SIMPLE_GRID_COLS_CONFIG}>
47+
<TelegramLink
48+
text={t('communities.link_bot_description')}
49+
title={t('communities.link_bot_title')}
50+
username={TG_USERNAME_HEXLET_CAREER_BOT}
51+
/>
52+
<TelegramLink
53+
text={t('communities.link_channel_hexlet_title')}
54+
title={t('communities.link_channel_hexlet_title')}
55+
username={TG_USERNAME_HEXLET_RU}
56+
/>
57+
<TelegramLink
58+
text={t('communities.link_channel_vacancies_description')}
59+
title={t('communities.link_channel_vacancies_title')}
60+
username={TG_USERNAME_HEXLET_JUNIOR_VACANCIES}
61+
/>
62+
</SimpleGrid>
63+
<Space h="md" />
64+
<Center>
65+
<Button
66+
color="black"
67+
fz="xs"
68+
onClick={() => {
69+
openTelegramLink('hexletcommunity')
70+
}}
71+
radius="md"
72+
variant="white"
73+
>
74+
{t('communities.action_connect_to')}
75+
</Button>
76+
</Center>
77+
</Container>
78+
)
79+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { Paper, Text } from '@mantine/core'
2+
import { openTelegramLink } from '../helpers/openTelegramInNewTab'
3+
4+
const FONT_SIZE_TELEGRAM_TITLE = 'lg'
5+
const FONT_SIZE_TELEGRAM_TEXT = 'xs'
6+
const STYLE_CURSOR_POINTER = { cursor: 'pointer' }
7+
8+
type TProps = {
9+
text: string
10+
title: string
11+
username: string
12+
}
13+
14+
export const TelegramLink: React.FC<TProps> = (props) => {
15+
const { text, title, username } = props
16+
17+
return (
18+
<Paper
19+
bg="dark.6"
20+
onClick={() => {
21+
openTelegramLink(username)
22+
}}
23+
p="sm"
24+
radius="md"
25+
style={STYLE_CURSOR_POINTER}
26+
withBorder
27+
>
28+
<Text c="white" fw={500} fz={FONT_SIZE_TELEGRAM_TITLE} ta="left">
29+
{title}
30+
</Text>
31+
<Text c="white" fz={FONT_SIZE_TELEGRAM_TEXT} ta="left">
32+
{text}
33+
</Text>
34+
</Paper>
35+
)
36+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export function openTelegramLink(username: string) {
2+
const tgUrl = `tg://resolve?domain=${username}`;
3+
const webUrl = `https://t.me/${username}`;
4+
5+
const tgWindow = window.open(tgUrl, '_blank', 'noopener,noreferrer');
6+
7+
setTimeout(() => {
8+
if (!tgWindow || tgWindow.closed) {
9+
window.open(webUrl, '_blank', 'noopener,noreferrer');
10+
}
11+
}, 500);
12+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {Communities} from './Communities';

0 commit comments

Comments
 (0)