-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/notifications #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
anu-mdl
wants to merge
39
commits into
main
Choose a base branch
from
feat/notifications
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
5907429
chore(cfg): добавлен expo-image-picker и плагин галереи
anu-mdl 28fa4dc
feat(shared): generic JSON-хелперы device-хранилища
anu-mdl 95fca13
feat(shared): ui-компоненты Avatar, MultiSelect, PhotoPicker
anu-mdl e681c6d
feat(activity): локальный список «Мои ивенты»
anu-mdl ebe632c
feat(participant): локальный список откликов «Посещено»
anu-mdl 675b287
feat(profile): сущность профиля (device-local)
anu-mdl 9c2e6f9
feat(features): запись созданных активностей и откликов в локальные с…
anu-mdl b6fe7be
feat(features): сценарий редактирования профиля
anu-mdl 4a39a48
feat(app): экраны профиля и ссылка «Профиль» в шапке
anu-mdl 7579054
docs: карта тестов профиля и уточнение продукт-дока
anu-mdl ed8d50b
feat(activity): лента скрывает прошедшие и сортирует по ближайшим
anu-mdl 670b00a
feat(activity): фильтр ленты по городу и поиску
anu-mdl c4cbe2c
feat(app): поля фильтра города и поиска в ленте
anu-mdl d73e720
feat(activity): расчёт остатка мест из capacity
anu-mdl 6d92fcc
feat(app): показ остатка мест на странице ивента
anu-mdl 6334671
feat(shared): хелпер шеринга публичной ссылки
anu-mdl b5ebf38
feat(app): кнопка «Поделиться» на странице и в управлении
anu-mdl 989ef32
feat(participant): отклик сведён к статусу «иду»
anu-mdl dd6f944
feat(features): форма отклика в один тап
anu-mdl d719f0f
feat(app): одно число статистики откликов
anu-mdl debf841
feat(activity): device-local лайки
anu-mdl 9b6046b
feat(features): хук лайка активности
anu-mdl 7769f9e
feat(app): кнопка лайка на странице ивента
anu-mdl fc08562
test(activity): схема создания и дедуп локального списка
anu-mdl c62dbb8
test(participant): схема отклика «иду» и дедуп откликов
anu-mdl fda2574
test(shared): ветвление шеринга ссылки
anu-mdl 881b10e
docs: карта тестов фазы 7
anu-mdl 94f9d35
feat(activity): поле chat_url в типах, схеме и маппере
anu-mdl 808e6cc
feat(app): поля ссылки на чат в формах создания и управления
anu-mdl 5735b24
feat(features): префилл chat_url из Telegram профиля при создании
anu-mdl c1d68af
feat(shared): ChatLinkButton — переход во внешний чат
anu-mdl 6a76a06
feat(app): кнопка чата на странице ивента
anu-mdl dca28d2
docs: добавлен бэклог задач
anu-mdl 26f4a77
feat(profile): TikTok и Discord в соцсетях профиля
anu-mdl 38eccb5
refactor(participant): убрано поле комментария из отклика
anu-mdl d548026
feat(activity): валидация chat_url по мессенджерам и префилл из Telegram
anu-mdl c68e8a5
add cycles to events
anu-mdl dba6ab4
fix(features): доработки по ревью PR #12
anu-mdl 587f9da
feat(activity): напоминания о встречах через локальные уведомления
anu-mdl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,71 +1,32 @@ | ||
| import { useState } from "react"; | ||
| import { Text } from "react-native"; | ||
| import { useCreateActivityForm } from "../src/features/create-activity/useCreateActivityForm"; | ||
| import { CreateActivityForm } from "../src/features/create-activity/CreateActivityForm"; | ||
| import { CreateSeriesForm } from "../src/features/create-series/CreateSeriesForm"; | ||
| import { BackLink } from "../src/shared/ui/BackLink"; | ||
| import { Button } from "../src/shared/ui/Button"; | ||
| import { DateTimeInput } from "../src/shared/ui/DateTimeInput"; | ||
| import { ErrorText } from "../src/shared/ui/ErrorText"; | ||
| import { FormField } from "../src/shared/ui/FormField"; | ||
| import { Page } from "../src/shared/ui/Page"; | ||
| import { Textarea } from "../src/shared/ui/Textarea"; | ||
| import { Select } from "../src/shared/ui/Select"; | ||
|
|
||
| type Mode = "activity" | "series"; | ||
|
|
||
| const modeOptions: { value: Mode; label: string }[] = [ | ||
| { value: "activity", label: "разовое" }, | ||
| { value: "series", label: "регулярное" }, | ||
| ]; | ||
|
|
||
| export default function CreatePage() { | ||
| const { form, submit, isSaving } = useCreateActivityForm(); | ||
| const { control, handleSubmit } = form; | ||
| const { errors } = form.formState; | ||
| const [mode, setMode] = useState<Mode>("activity"); | ||
|
|
||
| return ( | ||
| <Page> | ||
| <BackLink /> | ||
| <Text className="text-2xl font-bold">Создать активность</Text> | ||
| <FormField | ||
| control={control} | ||
| name="title" | ||
| label="название, обязательно" | ||
| error={errors.title?.message} | ||
| /> | ||
| <FormField | ||
| control={control} | ||
| name="description" | ||
| label="описание" | ||
| component={Textarea} | ||
| error={errors.description?.message} | ||
| /> | ||
| <FormField | ||
| control={control} | ||
| name="city" | ||
| label="город, обязательно" | ||
| error={errors.city?.message} | ||
| /> | ||
| <FormField | ||
| control={control} | ||
| name="location_text" | ||
| label="место текстом" | ||
| error={errors.location_text?.message} | ||
| /> | ||
| <FormField | ||
| control={control} | ||
| name="starts_at" | ||
| label="дата и время, обязательно" | ||
| component={DateTimeInput} | ||
| error={errors.starts_at?.message} | ||
| /> | ||
| <FormField | ||
| control={control} | ||
| name="capacity" | ||
| label="лимит мест, число или пусто" | ||
| error={errors.capacity?.message} | ||
| /> | ||
| <FormField | ||
| control={control} | ||
| name="cover_url" | ||
| label="ссылка на обложку" | ||
| error={errors.cover_url?.message} | ||
| /> | ||
| <Button | ||
| title={isSaving ? "Сохраняем..." : "Создать"} | ||
| onPress={handleSubmit(submit)} | ||
| /> | ||
| <ErrorText>{errors.root?.server?.message}</ErrorText> | ||
| <Text className="text-2xl font-bold">Создать</Text> | ||
| <Select | ||
| label="тип мероприятия" | ||
| value={mode} | ||
| onChange={setMode} | ||
| options={modeOptions} | ||
| /> | ||
| {mode === "activity" ? <CreateActivityForm /> : <CreateSeriesForm />} | ||
| </Page> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,37 +1,127 @@ | ||
| import { useState } from "react"; | ||
| import { Text, View } from "react-native"; | ||
| import { useActivities } from "../src/entities/activity/hooks"; | ||
| import type { Activity } from "../src/entities/activity/types"; | ||
| import { useSeries } from "../src/entities/series/hooks"; | ||
| import type { SeriesWithMeetings } from "../src/entities/series/types"; | ||
| import { | ||
| formatRecurrenceText, | ||
| listOccurrences, | ||
| } from "../src/entities/series/utils"; | ||
| import { ErrorText } from "../src/shared/ui/ErrorText"; | ||
| import { Input } from "../src/shared/ui/Input"; | ||
| import { LoadingText } from "../src/shared/ui/LoadingText"; | ||
| import { Page } from "../src/shared/ui/Page"; | ||
| import { TextLink } from "../src/shared/ui/TextLink"; | ||
|
|
||
| type FeedItem = { key: string; date: number; node: React.ReactNode }; | ||
|
|
||
| export default function HomePage() { | ||
| const activities = useActivities(); | ||
| const [city, setCity] = useState(""); | ||
| const [query, setQuery] = useState(""); | ||
| const filter = { city: city.trim(), query: query.trim() }; | ||
| const activities = useActivities(filter); | ||
| const series = useSeries(filter); | ||
| const items = buildFeed(activities.data ?? [], series.data ?? []); | ||
| const isLoading = activities.isLoading || series.isLoading; | ||
|
|
||
| return ( | ||
| <Page> | ||
| <Text className="text-4xl font-bold">Venty</Text> | ||
| <Text>Уродливые ссылки на активности, чтобы делать что-то с людьми</Text> | ||
| <TextLink href="/create">[Создать активность]</TextLink> | ||
| <Text className="text-2xl font-bold">Последние активности:</Text> | ||
| {activities.isLoading ? <LoadingText /> : null} | ||
| <Text>Уродливые ссылки на мероприятия, чтобы делать что-то с людьми</Text> | ||
| <TextLink href="/create">[Создать мероприятие]</TextLink> | ||
| <Input | ||
| label="Город" | ||
| value={city} | ||
| onChangeText={setCity} | ||
| placeholder="Например, Алматы" | ||
| /> | ||
| <Input | ||
| label="Поиск по названию" | ||
| value={query} | ||
| onChangeText={setQuery} | ||
| placeholder="Что ищем?" | ||
| /> | ||
| <Text className="text-2xl font-bold">Ближайшие мероприятия:</Text> | ||
| {isLoading ? <LoadingText /> : null} | ||
| <ErrorText | ||
| error={activities.error} | ||
| fallback="Не удалось загрузить активности" | ||
| error={activities.error ?? series.error} | ||
| fallback="Не удалось загрузить ленту" | ||
| /> | ||
| {activities.data?.length === 0 ? ( | ||
| <Text>Активностей пока нет.</Text> | ||
| {!isLoading && items.length === 0 ? ( | ||
| <Text>Мероприятий пока нет.</Text> | ||
| ) : null} | ||
| <View className="gap-2"> | ||
| {activities.data?.map((activity) => ( | ||
| <View key={activity.id} className="border-b border-gray-300 py-2"> | ||
| <Text> | ||
| {activity.title} — {activity.city} —{" "} | ||
| {new Date(activity.starts_at).toLocaleString()} | ||
| </Text> | ||
| <TextLink href={`/a/${activity.slug}`}>открыть</TextLink> | ||
| </View> | ||
| ))} | ||
| </View> | ||
| <View className="gap-2">{items.map((item) => item.node)}</View> | ||
| </Page> | ||
| ); | ||
| } | ||
|
|
||
| // Активности и серии в одной ленте по возрастанию даты ближайшей встречи. | ||
| function buildFeed( | ||
| activities: Activity[], | ||
| series: SeriesWithMeetings[], | ||
| ): FeedItem[] { | ||
| const activityItems = activities.map(toActivityItem); | ||
| const seriesItems = series.map(toSeriesItem); | ||
| return [...activityItems, ...seriesItems].sort((a, b) => a.date - b.date); | ||
| } | ||
|
|
||
| function toActivityItem(activity: Activity): FeedItem { | ||
| const startsAt = new Date(activity.starts_at); | ||
| return { | ||
| key: `activity-${activity.id}`, | ||
| date: startsAt.getTime(), | ||
| node: ( | ||
| <View | ||
| key={`activity-${activity.id}`} | ||
| className="border-b border-gray-300 py-2" | ||
| > | ||
| <Text> | ||
| {activity.title} — {activity.city} — {startsAt.toLocaleString()} | ||
| </Text> | ||
| <TextLink href={`/a/${activity.slug}`}>открыть</TextLink> | ||
| </View> | ||
| ), | ||
| }; | ||
| } | ||
|
|
||
| function toSeriesItem(series: SeriesWithMeetings): FeedItem { | ||
| const next = nextMeetingDate(series); | ||
| const schedule = formatRecurrenceText(series.recurrence, series.starts_at); | ||
| return { | ||
| key: `series-${series.id}`, | ||
| date: next?.getTime() ?? Number.POSITIVE_INFINITY, | ||
| node: ( | ||
| <View | ||
| key={`series-${series.id}`} | ||
| className="border-b border-gray-300 py-2" | ||
| > | ||
| <Text> | ||
| {series.title} — {series.city} · серия | ||
| </Text> | ||
| <Text className="text-gray-600"> | ||
| {next | ||
| ? `${schedule} · ближайшая: ${next.toLocaleString()}` | ||
| : `${schedule} · ближайших встреч нет`} | ||
| </Text> | ||
| <TextLink href={`/s/${series.slug}`}>открыть</TextLink> | ||
| </View> | ||
| ), | ||
| }; | ||
| } | ||
|
|
||
| // Ближайшая встреча в будущем: активный слот или следующая дата по правилу. | ||
| // Будущих встреч нет — возвращаем null, чтобы не поднимать серию прошедшим стартом. | ||
| function nextMeetingDate(series: SeriesWithMeetings): Date | null { | ||
| const now = Date.now(); | ||
| const fromMeetings = series.meetings | ||
| .filter((meeting) => meeting.status === "active") | ||
| .map((meeting) => new Date(meeting.starts_at).getTime()); | ||
| const fromRule = listOccurrences(series.recurrence, series.starts_at).map( | ||
| (iso) => new Date(iso).getTime(), | ||
| ); | ||
| const upcoming = [...fromMeetings, ...fromRule] | ||
| .filter((time) => time >= now) | ||
| .sort((a, b) => a - b); | ||
| return upcoming.length > 0 ? new Date(upcoming[0]) : null; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: linkerkz/project-e
Length of output: 2251
🏁 Script executed:
Repository: linkerkz/project-e
Length of output: 1300
🏁 Script executed:
Repository: linkerkz/project-e
Length of output: 10590
🏁 Script executed:
Repository: linkerkz/project-e
Length of output: 10590
nextMeetingDateне должен использовать дефолтныйhorizon = 5Для длинных повторяющихся серий
listOccurrences(...)обрежет будущие даты, и лента покажет «ближайших встреч нет», хотя они есть. Передайте здесь отдельный больший горизонт или ищите первую будущую дату без фиксированного лимита.🤖 Prompt for AI Agents