Skip to content

6411 Фурсова М.А. Лаб.2 Вар.2#106

Open
FursovaMashaa wants to merge 4 commits intoitsecd:mainfrom
FursovaMashaa:main
Open

6411 Фурсова М.А. Лаб.2 Вар.2#106
FursovaMashaa wants to merge 4 commits intoitsecd:mainfrom
FursovaMashaa:main

Conversation

@FursovaMashaa
Copy link
Copy Markdown

Реализовано веб-приложение для поиска ЖД-станций, просмотра расписания электричек и построения маршрутов по Самарской области.

@AvtoBBus AvtoBBus self-requested a review April 9, 2026 14:43
Copy link
Copy Markdown
Collaborator

@AvtoBBus AvtoBBus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Небольшие правки

Comment thread client/package-lock.json
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вот такие файлы в гит игнор, они генерируются после npm i

Нужны только package.json

Comment thread server/package-lock.json
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Аналогично про этот файл

Comment thread client/package.json
"preview": "vite preview"
},
"dependencies": {
"axios": "^1.14.0",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не советую использовать axios

https://habr.com/ru/companies/first/articles/1017244/

Comment thread client/src/App.jsx

<main className="main">
<section className="card">
<h2 className="card-title">Поиск</h2>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я конечно не эксперт UI, но наверное светлый текст на светлом фоне не особо

Image

Comment on lines +118 to +124
style={{
width: '100%',
height: '400px',
borderRadius: '12px',
marginBottom: '1rem',
border: '2px solid #e0e0e0'
}}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Во-первых, вынесите стили в .css
Во-вторых у вас поехали некоторые стили

Image

setLoading(true)
setError(null)
try {
const res = await fetch(`/api/rasp/route?from=${fromStation.code}&to=${toStation.code}&date=${date}`)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вообще в вашем случае работает, но по-хорошему добавлять в начале полный url сервера, который лежит где-нибудь в .env

fetch(import.meta.env.BASE_URL + url)

Comment thread server/index.js
app.use(cors())
app.use(express.json())

const BASE_URL = 'https://api.rasp.yandex-net.ru/v3.0'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тоже в .env

Comment thread server/index.js

let stationsCache = []
let cacheTimestamp = null
const CACHE_TTL = 24 * 60 * 60 * 1000
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тоже в .env

Comment thread server/index.js
Comment on lines +96 to +113
if (region === 'samara') {
const SAMARA_BBOX = {
minLon: 49.5, maxLon: 51.0,
minLat: 52.8, maxLat: 53.8
}
filtered = filtered.filter(s =>
s.latitude >= SAMARA_BBOX.minLat && s.latitude <= SAMARA_BBOX.maxLat &&
s.longitude >= SAMARA_BBOX.minLon && s.longitude <= SAMARA_BBOX.maxLon
)
}

filtered.sort((a, b) => {
const aTitle = a.title.toLowerCase()
const bTitle = b.title.toLowerCase()
if (aTitle === 'самара' && bTitle !== 'самара') return -1
if (bTitle === 'самара' && aTitle !== 'самара') return 1
return aTitle.localeCompare(bTitle)
})
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не совсем надёжная проверка на то что это станция Самарская, есть esr_code

Comment thread server/index.js
}
})

const PORT = 3001
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тоже в .env

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants