Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into 2808-Add-a-filter-by-date-…
Browse files Browse the repository at this point in the history
…option-to-events
  • Loading branch information
bahaaTuffaha committed Nov 20, 2024
2 parents abb3d98 + 18c1a6b commit 4990e93
Show file tree
Hide file tree
Showing 50 changed files with 1,678 additions and 278 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ labels: Bug

### Additional Information

<!-- Add any other context (e.g. logs, screenshots, environment etc.) about the problem here. -->
<!-- Add any other context (e.g. logs, screenshots, environment, related issues etc.) about the problem here. -->

<details>
<summary>Traceback</summary>
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ A clear and concise description of what you want to happen.
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
Add any other context or screenshots about the feature request here. If applicable link any related issues or back-end issues.
19 changes: 6 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,22 @@ React JS and React Native App for [Integreat](https://integreat-app.de), [Malte]
- [Project Structure](#project-structure)
- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Project setup](#project-setup)
- [Project Setup](#project-setup)
- [Further Reading](#further-reading)

## Contributing

First, make sure you have a look at our [conventions](docs/conventions.md).

You can contribute by:

- [Creating Pull requests](docs/contributing.md#pull-requests)
- [Reporting bugs](docs/contributing.md#bug-reporting)
- [Reporting bugs](docs/contributing.md#reporting-issues-and-bugs)
- [Creating pull requests](docs/contributing.md#pull-requests)
- [Reviewing pull requests](docs/contributing.md#reviews)

If you want to know more about Integreat or if you want to join us, contact [Leandra](mailto:[email protected]),
[Steffen](mailto:[email protected]) or [our info mail](mailto:[email protected]) and visit our [website](https://integreat-app.de).

We use this emoji code for reviewing:

- :+1: or `:+1:` This is great! It always feels good when somebody likes your work. Show them!
- :question: or `:question:` I have a question / can you clarify?
- :x: or `:x:` This has to change. It’s possibly an error or strongly violates existing conventions.
- :wrench: or `:wrench:` This is a well-meant suggestion. Take it or leave it.
- :upside_down_face: or `:upside_down_face:` This is a nitpick. Normally related to a small formatting or stylizing detail that shouldn’t block moving forward.
- :thought_balloon: or `:thought_balloon:` I’m just thinking out loud here. Something doesn’t necessarily have to change, but I want to make sure to share my thoughts.
- :clown_face: or `:clown_face:` This is a complaint about something with no obvious answer, not necessarily a problem originating from changes.

## Project Structure

This is a monorepo and contains the following projects:
Expand Down
19 changes: 19 additions & 0 deletions assets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Assets

All build-config and platform independent assets should be placed in this directory.
All assets should use kebab-case naming.

## Icons

### Conventions

Icons should be added to the corresponding [icons](icons) subfolder.
Normal icons are supposed to follow the following conventions:

- Use the SVG format
- Resize to 24x24px with width and height set
- The viewbox starts at (0, 0)
- Set the general icon color to `currentColor` (using `fill="currentColor"`)
- The SVG should be as simple and reduced as possible

If the icon has e.g. a build-config dependent background, you can use `fill="var(--theme-color, none)"`.
2 changes: 2 additions & 0 deletions build-configs/common/theme/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export type ColorsType = {
positiveHighlight: string
negativeHighlight: string
invalidInput: string
warningColor: string
linkColor: string
themeContrast: string
}
Expand All @@ -31,5 +32,6 @@ export const commonLightColors = {
positiveHighlight: '#188038',
negativeHighlight: '#8b0000',
invalidInput: '#B3261E',
warningColor: '#FFA726',
linkColor: '#0b57d0',
}
26 changes: 24 additions & 2 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@ by [reporting a bug](#reporting-issues-and-bugs), [opening a pull request](#pull
or [contacting us](#contact-us) if you don't know where to start. Please make sure to have a look at
our [conventions](conventions.md).

## Contact us
Before contributing, please make sure to have a look at our [conventions](conventions.md).

## Contents

- [Contact](#contact-us)
- [Reporting Issues and Bugs](#reporting-issues-and-bugs)
- [Pull Requests](#pull-requests)
- [Release Notes](#release-notes)
- [Reviews](#reviews)

## Contact Us

If you don't know where to start or if you want to know more about Integreat,
contact [Leandra](mailto:[email protected]),
Expand All @@ -23,7 +33,7 @@ our [project views](https://github.com/orgs/digitalfabrik/projects/2/views/1).

If you open a new issue, please make sure to follow the templates and create meaningful issues and bugs.

## Pull requests
## Pull Requests

Before starting to write code and opening a pull request, please take a look [at our conventions](conventions.md).

Expand Down Expand Up @@ -58,3 +68,15 @@ The release notes can be found [here](../release-notes) and are automatically mo
release.
They are also shown in the stores and
the [release section of github](https://github.com/digitalfabrik/integreat-app/releases).

### Reviews

We use the following emoji code for reviewing:

- :+1: or `:+1:` This is great! It always feels good when somebody likes your work. Show them!
- :question: or `:question:` I have a question / can you clarify?
- :x: or `:x:` This has to change. It’s possibly an error or strongly violates existing conventions.
- :wrench: or `:wrench:` This is a well-meant suggestion. Take it or leave it.
- :upside_down_face: or `:upside_down_face:` This is a nitpick. Normally related to a small formatting or stylizing detail that shouldn’t block moving forward.
- :thought_balloon: or `:thought_balloon:` I’m just thinking out loud here. Something doesn’t necessarily have to change, but I want to make sure to share my thoughts.
- :clown_face: or `:clown_face:` This is a complaint about something with no obvious answer, not necessarily a problem originating from changes.
11 changes: 11 additions & 0 deletions docs/conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
- [Testing](#testing)
- [Code Quality](#code-quality)
- [Commit Messages and Pull Requests](#commit-messages-and-pull-request)
- [Reviews](#reviews)
- [Versioning](#versioning)
- [Folder Structure](#folder-structure)
- [Assets and Icons](#assets-and-icons)

## Naming

Expand Down Expand Up @@ -89,6 +91,10 @@ write good commit messages. Commit messages should have the following schema:

The same applies for PR names.

## Reviews

We use an [emoji code](contributing.md#reviews) for reviewing.

## Versioning

Versions consist of a version name and a version code.
Expand Down Expand Up @@ -135,3 +141,8 @@ src
│ LanguageDetector.ts
| indext.ts
```

## Assets and Icons

We place our build-config and platform independent assets and icons in the [assets](../assets) in the root directory.
See more information in the corresponding [README](../assets/README.md).
5 changes: 2 additions & 3 deletions native/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ Depending on whether you want to develop for Android, iOS or both the following

- Install Java JDK, SDK and Runtime (v8 or v11).
- Install the Android SDK by using
the [Android Support plugin](https://plugins.jetbrains.com/plugin/1792-android-support) in IntelliJ.
- Install the latest stable SDK Platform and Android SDK Tools in the SDK Manager (Settings > Appearance & Behaviour >
System Settings > Android SDK).
the [Android plugin](https://plugins.jetbrains.com/plugin/22989-android) in IntelliJ.
- Install the latest stable SDK Platform and Android SDK Tools in the SDK Manager (Settings > Languages & Frameworks > Android SDK Updater).
- Install and accept the SDK license in the SDK Manager.
- [optional] If you want to develop using an emulator, also install the Android Emulator in the Android SDK settings.

Expand Down
7 changes: 6 additions & 1 deletion native/src/components/Caption.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ const H1 = styled(Text)`
`
type CaptionProps = {
title: string
language?: string
}

const Caption = ({ title }: CaptionProps): ReactElement => <H1 android_hyphenationFrequency='full'>{title}</H1>
const Caption = ({ title, language }: CaptionProps): ReactElement => (
<H1 android_hyphenationFrequency='full' accessibilityLanguage={language}>
{title}
</H1>
)

export default Caption
2 changes: 1 addition & 1 deletion native/src/components/CategoryListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const CategoryListItem = ({
onItemPress,
}: CategoryListItemProps): ReactElement => (
<>
<FlexStyledLink role='link' onPress={() => onItemPress({ path: category.path })}>
<FlexStyledLink role='link' onPress={() => onItemPress({ path: category.path })} accessibilityLanguage={language}>
<DirectionContainer language={language}>
<CategoryEntryContainer>
<TitleDirectionContainer language={language}>
Expand Down
10 changes: 8 additions & 2 deletions native/src/components/CityEntry.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React, { Fragment, memo, ReactElement } from 'react'
import React, { Fragment, memo, ReactElement, useContext } from 'react'
import { Text } from 'react-native'
import Highlighter from 'react-native-highlight-words'
import styled from 'styled-components/native'

import { normalizeString } from 'shared'
import { CityModel } from 'shared/api'

import { AppContext } from '../contexts/AppContextProvider'
import testID from '../testing/testID'
import Pressable from './base/Pressable'

Expand Down Expand Up @@ -52,6 +53,7 @@ const CityEntry = ({ city, query, navigateToDashboard }: CityEntryProps): ReactE
? Object.keys(city.aliases).filter(alias => normalizeString(alias).includes(normalizedQuery))
: []
const aliases = matchingAliases.slice(0, MAX_NUMBER_OF_ALIASES_SHOWN)
const { languageCode } = useContext(AppContext)

const Aliases =
aliases.length > 0 ? (
Expand Down Expand Up @@ -86,7 +88,11 @@ const CityEntry = ({ city, query, navigateToDashboard }: CityEntryProps): ReactE
) : null

return (
<CityListItem role='link' {...testID('City-Entry')} onPress={() => navigateToDashboard(city)}>
<CityListItem
role='link'
{...testID('City-Entry')}
onPress={() => navigateToDashboard(city)}
accessibilityLanguage={languageCode}>
<>
<Label
searchWords={[normalizedQuery]}
Expand Down
7 changes: 7 additions & 0 deletions native/src/components/CitySelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ const SearchBar = styled.View`
padding: 0 10%;
`

const SearchCounter = styled.Text`
margin: 15px 0 10px;
color: ${props => props.theme.colors.textSecondaryColor};
font-weight: 500;
`

type CitySelectorProps = {
cities: CityModel[]
navigateToDashboard: (city: CityModel) => void
Expand Down Expand Up @@ -70,6 +76,7 @@ const CitySelector = ({ cities, navigateToDashboard }: CitySelectorProps): React
<CityGroup>{t('nearbyCities')}</CityGroup>
<NearbyCities cities={cities} navigateToDashboard={navigateToDashboard} filterText={filterText} />
</CityGroupContainer>
<SearchCounter>{t('search:searchResultsCount', { count: resultCities.length })}</SearchCounter>
{resultCities.length === 0 ? <NothingFound paddingTop /> : cityEntries}
</View>
</View>
Expand Down
38 changes: 26 additions & 12 deletions native/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
SETTINGS_ROUTE,
} from 'shared'
import { LanguageModel, FeedbackRouteType } from 'shared/api'
import { config } from 'translations'

import { NavigationProps, RouteProps, RoutesParamsType, RoutesType } from '../constants/NavigationTypes'
import buildConfig from '../constants/buildConfig'
Expand Down Expand Up @@ -199,32 +200,45 @@ const Header = ({
]
: []

const getHeaderText = (): string => {
const getHeaderText = (): { text: string; language?: string } => {
const currentTitle = (route.params as { title?: string } | undefined)?.title
if (!previousRoute) {
// Home/Dashboard: Show current route title, i.e. city name
return currentTitle ?? ''
return { text: currentTitle ?? '', language: config.sourceLanguage }
}

const previousParams = previousRoute.params

const currentRouteIsPoi = route.name === POIS_ROUTE
const poisRouteParams = route.params as RoutesParamsType[PoisRouteType]
const isSinglePoi = !!poisRouteParams.slug || poisRouteParams.multipoi !== undefined
const notFromDeepLink = previousRoute.name === POIS_ROUTE
if (currentRouteIsPoi && notFromDeepLink) {
const poisRouteParams = route.params as RoutesParamsType[PoisRouteType]
if (poisRouteParams.slug || poisRouteParams.multipoi !== undefined) {
return t('locations')
if (isSinglePoi && notFromDeepLink) {
return { text: t('locations'), language: undefined } // system language
}

const previousRouteTitle = (previousRoute.params as { path?: string } | undefined)?.path

if (previousRouteTitle) {
return { text: previousRouteTitle, language: languageCode }
}

if (previousRoute.name === CATEGORIES_ROUTE) {
return {
text: t('localInformation'),
language: languageCode,
}
}

const previousRouteTitle = (previousParams as { title?: string } | undefined)?.title
return previousRouteTitle ?? t(previousRoute.name === 'categories' ? 'localInformation' : previousRoute.name)
return { text: previousRoute.name, language: undefined } // system language
}

return (
<BoxShadow>
<Horizontal>
<HeaderBox goBack={navigation.goBack} canGoBack={canGoBack} text={getHeaderText()} />
<HeaderBox
goBack={navigation.goBack}
canGoBack={canGoBack}
text={getHeaderText().text}
language={getHeaderText().language}
/>
<CustomHeaderButtons cancelLabel={t('cancel')} items={items} overflowItems={overflowItems} />
</Horizontal>
</BoxShadow>
Expand Down
9 changes: 7 additions & 2 deletions native/src/components/HeaderBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ type HeaderBoxProps = {
goBack?: () => void
canGoBack?: boolean
text?: string
language?: string
}

const HeaderBox = ({ goBack, canGoBack = true, text }: HeaderBoxProps): ReactElement => {
const HeaderBox = ({ goBack, canGoBack = true, text, language }: HeaderBoxProps): ReactElement => {
const deviceWidth = useWindowDimensions().width
const theme = useTheme()
const { t } = useTranslation('common')
Expand All @@ -49,10 +50,14 @@ const HeaderBox = ({ goBack, canGoBack = true, text }: HeaderBoxProps): ReactEle
) : (
<StyledIcon Icon={AppIcon} />
)

return (
<HorizontalLeft>
{HeaderIcon}
<HeaderText allowFontScaling={false} fontSize={deviceWidth * dimensions.fontScaling}>
<HeaderText
allowFontScaling={false}
fontSize={deviceWidth * dimensions.fontScaling}
accessibilityLanguage={language}>
{text}
</HeaderText>
</HorizontalLeft>
Expand Down
2 changes: 1 addition & 1 deletion native/src/components/ListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type ListItemProps = {
}

const ListItem = ({ language, title, thumbnail, children, Icon, navigateTo }: ListItemProps): ReactElement => (
<StyledPressable onPress={navigateTo} role='link'>
<StyledPressable onPress={navigateTo} accessibilityLanguage={language} role='link'>
<ListItemView language={language}>
<Thumbnail source={thumbnail} />
<Description>
Expand Down
6 changes: 3 additions & 3 deletions native/src/components/MapView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ const MapView = ({
)

const onRequestLocation = useCallback(async () => {
if (userLocation) {
moveTo(userLocation)
const newUserLocation = userLocation ?? (await refreshPermissionAndLocation())?.coordinates
if (newUserLocation) {
moveTo(newUserLocation)
setFollowUserLocation(true)
}
await refreshPermissionAndLocation()
}, [refreshPermissionAndLocation, moveTo, userLocation])

useEffect(() => {
Expand Down
Loading

0 comments on commit 4990e93

Please sign in to comment.