Skip to content

Commit

Permalink
Merge branch 'hasadna:main' into mktana
Browse files Browse the repository at this point in the history
  • Loading branch information
mktana authored Jan 21, 2024
2 parents 5712c9e + 9368bdb commit ca721c8
Show file tree
Hide file tree
Showing 16 changed files with 2,664 additions and 68 deletions.
2,342 changes: 2,341 additions & 1 deletion package-lock.json

Large diffs are not rendered by default.

Binary file added src/img/busImg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/layout/sidebar/menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ function getItem(
const MainMenu = () => {
const { t } = useTranslation()
const items: MenuItem[] = PAGES.map((itm) => {
return getItem(<Link to={t(itm.path)}>{t(itm.label)}</Link>, itm.path, itm.icon)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return getItem(<Link to={t(itm.path as any)}>{t(itm.label as any)}</Link>, itm.path, itm.icon)
})

const location = useLocation()
Expand Down
8 changes: 8 additions & 0 deletions src/locale/allTranslations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,12 @@ i18n.use(initReactI18next).init({
lng: 'he',
})

declare module 'i18next' {
interface CustomTypeOptions {
resources: {
translation: typeof translationsHE
}
}
}

export default i18n
22 changes: 20 additions & 2 deletions src/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@
"bug_contact_name_message": "Please enter your full name!",
"bug_contact_email": "Email",
"bug_contact_email_message": "Please enter your email!",
"bug_form_description": "This form is designed so that we can receive feedback and improve the application.",
"bug_type": "Type of request",
"bug_type_message": "Please enter the type of request",
"bug_type_bug": "Bug",
Expand All @@ -115,10 +114,29 @@
"coords": "coords",
"hide_document": "hide document",
"show_document": "show document",
"aboutPage": {
"title": "About us",
"privacyText": "<0>Google Analytics</0> service is embedded in the website to analyze the usage patterns and positioning of the website in search engines. This code reveals to the operators of the service information regarding the behavior of the users. <1>Learn more</1> about the privacy policy of the service.",
"licenseInfo": {
"text": "All information displayed on the website is based on data published by government sources. Usage of the information is subject to the <0>CC BY-SA 4.0 license</0> of <1>Creative Commons</1>"
},
"contactLinksText": {
"sadna": "Contact us",
"slack": "Chat with us on Slack",
"donations": "Servers cost money - help us continue to maintain and develop the project!"
}
},
"dashboard_page_graph_title_hour": "Percentage of rides out, by hour",
"dashboard_page_graph_title_day": "Percentage of rides out, by day",
"group_by_day_tooltip_content": "Group by day",
"order_by_hour": "by hour",
"order_by_severity": "by severity",
"choose_dates": "Dates"
"choose_dates": "Dates",
"single_line_map_title": "Locations of selected lines",
"reportBug": {
"description": "This form is designed so that we can receive feedback and improve the application. Please be aware that the submitted information will be available to the public.",
"error": "An error occurred while sending the report. Please try again later.",
"success": "The report was sent successfully. Thank you for your help!",
"viewIssue": "View issue"
}
}
24 changes: 22 additions & 2 deletions src/locale/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@
"bug_contact_name_message": "אנא הזן את שמך!",
"bug_contact_email": "אי-מייל",
"bug_contact_email_message": "אנא הזן כתובת אי-מייל!",
"bug_form_description": "טופס זה נועד על מנת שנוכל לקבל פידבק ולשפר את האפליקציה.",
"bug_type": "סוג הבקשה",
"bug_type_message": "אנא הזן סוג בקשה!",
"bug_type_bug": "באג",
Expand Down Expand Up @@ -127,10 +126,31 @@
"text2": "אם הבעיה נמשכת, אנא פנה אלינו בכתובת:",
"button": "חזרה לדף הבית"
},
"aboutPage": {
"title": "קצת עלינו",
"privacyText": "באתר מוטמע שירות <0>Google Analytics</0> לניתוח דפוסי השימוש ומיצוב האתר במנועי חיפוש. קוד זה חושף בפני מפעילי השירות מידע בנוגע להתנהגות המשתמשים. <1>קראו כאן</1> על מדיניות הפרטיות של השירות.",
"licenseInfo": {
"text": "כל המידע המוצג באתר מבוסס על נתונים המפורסמים במקורות המידע הממשלתיים. השימוש במידע כפוף לרישיון <0>{{licenseName}}</0> של <1>Creative Commons</1>.",
"licenseName": "רישיון CC BY-SA 4.0"
},
"contactLinksText": {
"sadna": "צרו איתנו קשר",
"slack": " דברו איתנו על זה בסלאק",
"donations": "שרתים עולים כסף - עזרו לנו להמשיך לתחזק ולפתח את הפרויקט!"
}
},

"dashboard_page_graph_title_hour": "אחוזי יציאה מסך הנסיעות לפי שעה",
"dashboard_page_graph_title_day": "אחוזי יציאה מסך הנסיעות לפי יום",
"group_by_day_tooltip_content": "קיבוץ לפי יום",
"order_by_hour": "לפי שעה",
"order_by_severity": "לפי חומרה",
"choose_dates": "תאריכים"
"choose_dates": "תאריכים",
"single_line_map_title": "מיקומים של קו שנבחר",
"reportBug": {
"description": "טופס זה נועד על מנת שנוכל לקבל פידבק ולשפר את האפליקציה. לתשומת לבך - הטופס נשלח לGitHub, והמידע שיצויין בו יהיה ציבורי.",
"error": "אירעה שגיאה בעת שליחת הדיווח. אנא נסה שוב מאוחר יותר.",
"success": "תודה על הדיווח!",
"viewIssue": "לצפייה בדיווח"
}
}
47 changes: 29 additions & 18 deletions src/pages/BugReportForm .tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState } from 'react'
import { useTranslation } from 'react-i18next'
import { Form, Input, Button, Upload, message, Select, FormProps, Card } from 'antd'
import { UploadOutlined } from '@ant-design/icons'
// import axios from 'axios'
import axios from 'axios'
import './BugReportForm.scss'
import { UploadChangeParam, UploadFile } from 'antd/lib/upload'
const { Option } = Select
Expand All @@ -19,33 +19,38 @@ interface BugReportFormData {
contactEmail: string
}

const BugReportForm: React.FC = () => {
const BugReportForm = () => {
const { t } = useTranslation()
const [form] = Form.useForm()
const [fileList, setFileList] = useState<UploadFile[]>([])
const [selectedType, setSelectedType] = useState<string | undefined>(undefined)
const [submittedUrl, setSubmittedUrl] = useState<string | undefined>(undefined)

//Not implemented yet
const onFinish = async (values: BugReportFormData) => {
try {
// Send the bug report data to the server
// Include fileList in the values if needed

// const response = await axios.post('http://localhost:3001/create-issue', {
// ...values,
// attachments: fileList,
// })

console.log(values)

// Handle the server response
// message.success('Bug report submitted successfully!')
message.success('Not implemented!')
form.resetFields()
setFileList([]) // Reset fileList after submission
const response = await axios.post(
'https://open-bus-backend.k8s.hasadna.org.il/create-issue',
{
...values,
attachments: fileList,
},
)

setSubmittedUrl(response.data.url)
if (response.data.state === 'open') {
message.success(t('reportBug.success'))
form.resetFields()
setFileList([])
} else {
message.error(t('reportBug.error'))
}
} catch (error) {
console.error('Error submitting bug report:', error)
message.error('Error submitting bug report. Please try again.')
message.error(t('reportBug.error'))
}
}

Expand All @@ -61,9 +66,15 @@ const BugReportForm: React.FC = () => {
<Card className="bug-report-form-container">
<h1 className="logo">דאטאבוס</h1>

<span> {t('bug_form_description')} </span>
<br />
<br />
<span> {t('reportBug.description')}</span>

<p>
{submittedUrl && (
<a href={submittedUrl} target="_blank" rel="noopener noreferrer">
{t('reportBug.viewIssue')} (Github)
</a>
)}
</p>

<Form
form={form}
Expand Down
57 changes: 39 additions & 18 deletions src/pages/about/index.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
import styled from 'styled-components'
import SlackIcon from '../../resources/slack-icon.svg'
import { useTranslation } from 'react-i18next'
import { Trans, useTranslation } from 'react-i18next'
import Widget from 'src/shared/Widget'
import { Space, Typography } from 'antd'

import './About.scss'
const { Title } = Typography
const pageName = 'aboutPage'
const About = () => {
const { t } = useTranslation()
return (
<AboutStyle>
<Space direction="vertical" size="middle">
<Title className="page-title" level={3}>
קצת עלינו
{t(`${pageName}.title`)}
</Title>
<WhatIsWebsite />
<DiscoveredMistake />
<Privacy />
<License />
<Questions />
<Funding />
<Attributions />
</Space>
</AboutStyle>
)
Expand Down Expand Up @@ -52,59 +55,61 @@ const DiscoveredMistake = () => {

const Privacy = () => {
const { t } = useTranslation()

const googlAnalyticsUrl = 'https://marketingplatform.google.com/about/analytics/'
const googleAnaliticsPrivacyUrl = 'https://support.google.com/analytics/answer/6004245?hl=iw'
return (
<Widget>
<h2>{t('privacy')}</h2>
<p>
באתר מוטמע שירות{' '}
<a href="https://marketingplatform.google.com/about/analytics/">Google Analytics </a>
לניתוח דפוסי השימוש ומיצוב האתר במנועי חיפוש. קוד זה חושף בפני מפעילי השירות מידע בנוגע
להתנהגות המשתמשים.
<a href="https://support.google.com/analytics/answer/6004245?hl=iw"> קראו כאן </a>
על מדיניות הפרטיות של השירות.
<Trans i18nKey="aboutPage.privacyText">
<a href={googlAnalyticsUrl}></a>
<a href={googleAnaliticsPrivacyUrl}></a>
</Trans>
</p>
</Widget>
)
}

const License = () => {
const { t } = useTranslation()

const licenseLink = 'https://creativecommons.org/licenses/by-sa/4.0/'
const licenseOrgLink = 'https://creativecommons.org/'
return (
<Widget>
<h2>{t('license')}</h2>
<p>
כל המידע המוצג באתר מבוסס על נתונים המפורסמים במקורות המידע הממשלתיים. השימוש במידע כפוף ל
<a href="https://creativecommons.org/licenses/by-sa/4.0/">רישיון CC BY-SA 4.0 </a>
של
<a href="https://creativecommons.org/"> Creative Commons</a>.
<Trans
i18nKey="aboutPage.licenseInfo.text"
values={{ licenseName: t('aboutPage.licenseInfo.licenseName') }}>
<a href={licenseLink}></a>
<a href={licenseOrgLink}></a>
</Trans>
</p>
</Widget>
)
}

const Questions = () => {
const { t } = useTranslation()

const linksTextPath = `${pageName}.contactLinksText`
return (
<Widget>
<h2>{t('questions')}</h2>
<ul>
<li>
<a href="https://www.hasadna.org.il/%D7%A6%D7%95%D7%A8-%D7%A7%D7%A9%D7%A8/">
צרו איתנו קשר
{t(`${linksTextPath}.sadna`)}
</a>
</li>
<li>
<img src={SlackIcon} alt="Slack icon" />
<a href="https://hasadna.slack.com/join/shared_invite/zt-167h764cg-J18ZcY1odoitq978IyMMig#/shared-invite/email">
דברו איתנו על זה בסלאק
{t(`${linksTextPath}.slack`)}
</a>
</li>
<li>
<a href="https://www.jgive.com/new/he/ils/donation-targets/3268#donation-modal">
שרתים עולים כסף- עזרו לנו להמשיך לתחזק ולפתח את הפרויקט!
{t(`${linksTextPath}.donations`)}
</a>
</li>
</ul>
Expand Down Expand Up @@ -138,6 +143,22 @@ const Funding = () => {
)
}

const Attributions = () => {
return (
<Widget>
<h2>Attributions</h2>
Bus ifmage by{' '}
<a
href="https://www.freepik.com/free-vector/passengers-waiting-bus-city-queue-town-road-flat-vector-illustration-public-transport-urban-lifestyle_10173277.htm#query=public%20transportation&position=0&from_view=search&track=ais&uuid=70a79b38-20cb-42b8-9dde-b96a68088522"
target="_blank"
rel="noopener noreferrer nofollow">
pch.vector
</a>{' '}
on Freepik
</Widget>
)
}

const AboutStyle = styled.div`
display: flex;
flex-direction: column;
Expand Down
4 changes: 4 additions & 0 deletions src/pages/homepage/HomePage.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.main-menu {
display: flex;
flex-direction: column;
}
34 changes: 34 additions & 0 deletions src/pages/homepage/HomePage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { NavLink } from 'react-router-dom'
import busImage from '../../img/busImg.png'
import './HomePage.scss'

export const HomePage = () => {
return (
<>
<img src={busImage} alt="Public Transportaion Bus Illustration" />
<h1>ברוכים הבאים לדאטאבוס</h1>
<h2>הפלטפורמה הפתוחה לנתוני אמת על איכות קווי התחבורה הציבורית בישראל </h2>
<h3>
מטרת האתר היא לשפר את איכות התחבורה הציבורית בארץ ע״י מתן מידע אמין לעיתונאים, אזחרים, חברות
התחבורה, וגורמי ממשל בישראל.
</h3>
<div className="main-menu">
<NavLink to="/timeline" className="nav-link">
הסטוריית לוחות זמנים
</NavLink>
<NavLink to="/gaps" className="nav-link">
{' '}
נסיעות שלא בוצעו{' '}
</NavLink>
<NavLink to="/gaps_pattern" className="nav-link">
דפוסי נסיעות שלא בוצעו
</NavLink>
<NavLink to="/map" className="nav-link">
מפה בזמן אמת
</NavLink>
</div>
</>
)
}

export default HomePage
Loading

0 comments on commit ca721c8

Please sign in to comment.