-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Filters * groups api * Group searching logic with mocked data and language filter * Adding proper filter values reordering code * groups api draft * fixed search logic * Reordering by Year * lint error * New Groups Page Design * General fixes * added svg platform icons * added 2022/2023 * pr requested changes * margin fix * Flatlist and ordered groups fix * fix no members * small styling fixes --------- Co-authored-by: Tommaso Morganti <tommaso.morganti01@gmail.com>
- Loading branch information
Showing
30 changed files
with
1,281 additions
and
78 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { DataSourceParam } from "@shopify/react-native-skia" | ||
import whatsapp from "./whatsapp.svg" | ||
import facebook from "./facebook.svg" | ||
import telegram from "./telegram.svg" | ||
|
||
/** | ||
* list of tray icons | ||
*/ | ||
export const platformIconList = ["telegram", "whatsapp", "facebook"] as const | ||
|
||
export type PlatformIcon = typeof platformIconList[number] | ||
|
||
export const platformIcons: Record< | ||
PlatformIcon, | ||
{ svg: DataSourceParam; width: number; heigth: number } | ||
> = { | ||
whatsapp: { | ||
svg: whatsapp, | ||
width: 24, | ||
heigth: 24, | ||
}, | ||
telegram: { | ||
svg: telegram, | ||
width: 24, | ||
heigth: 24, | ||
}, | ||
facebook: { | ||
svg: facebook, | ||
width: 25, | ||
heigth: 24, | ||
}, | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { HttpClient, RequestOptions } from "./HttpClient" | ||
|
||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
|
||
export interface GroupOptions { | ||
name?: string | ||
year?: string | ||
degree?: string | ||
type?: string | ||
platform?: string | ||
language?: string | ||
office?: string | ||
} | ||
|
||
export interface Group { | ||
class: string | ||
office: string | ||
id: string | ||
degree?: string | ||
school?: string | ||
link_id: string | ||
language: string | ||
type_?: string | ||
year: string | null //probably I should use | null evreywhere? | ||
platform: string | ||
permanent_id?: number | ||
last_updated?: string | ||
link_is_working?: string | ||
members?: string | ||
} | ||
|
||
const client = HttpClient.getInstance() | ||
|
||
/** | ||
* Collection of endpoints related to Groups. | ||
*/ | ||
export const groups = { | ||
/** | ||
* Retrieves groups from PoliNetwork server. | ||
* Check {@link GroupOptions} for additional parameters. | ||
*/ | ||
async get(groupsOptions?: GroupOptions, options?: RequestOptions) { | ||
const response = await client.poliNetworkInstance.get<{ | ||
groups: Group[] | ||
}>("/v1/groups", { | ||
...options, | ||
params: { | ||
name: groupsOptions?.name, | ||
year: groupsOptions?.year, | ||
degree: groupsOptions?.degree, | ||
type: groupsOptions?.type, | ||
platform: groupsOptions?.platform, | ||
language: groupsOptions?.language, | ||
office: groupsOptions?.office, | ||
}, | ||
}) | ||
return response.data.groups | ||
}, | ||
} |
This file contains 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 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 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,19 +1,25 @@ | ||
import React, { FC } from "react" | ||
import { View } from "react-native" | ||
import { View, ViewStyle } from "react-native" | ||
|
||
export interface DividerProps { | ||
color?: string | ||
height?: number | ||
width?: number | ||
style?: ViewStyle | ||
} | ||
|
||
export const Divider: FC<DividerProps> = props => { | ||
return ( | ||
<View | ||
style={{ | ||
backgroundColor: props.color ?? "#8791BD", | ||
height: props.height ?? 1, | ||
width: "100%", | ||
}} | ||
style={[ | ||
{ | ||
backgroundColor: props.color ?? "#8791BD", | ||
height: props.height ?? 1, | ||
width: props.width ?? "100%", | ||
}, | ||
|
||
props.style, | ||
]} | ||
/> | ||
) | ||
} |
This file contains 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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React, { FC } from "react" | ||
import { Animated, Easing, ViewStyle } from "react-native" | ||
import { usePalette } from "utils/colors" | ||
|
||
export interface AnimatedLineProps { | ||
/** | ||
* animate when this value changes | ||
*/ | ||
mounted: boolean | ||
color?: string | ||
height?: number | ||
width?: number | ||
style?: ViewStyle | ||
} | ||
|
||
export const AnimatedLine: FC<AnimatedLineProps> = props => { | ||
const { isLight } = usePalette() | ||
|
||
const { current: widthAnim } = React.useRef<Animated.Value>( | ||
new Animated.Value(1) | ||
) | ||
|
||
React.useEffect(() => { | ||
if (props.mounted) { | ||
Animated.timing(widthAnim, { | ||
toValue: 250, | ||
duration: 300, | ||
easing: Easing.ease, | ||
useNativeDriver: false, | ||
}).start() | ||
} else { | ||
Animated.timing(widthAnim, { | ||
toValue: 0, | ||
duration: 300, | ||
easing: Easing.ease, | ||
useNativeDriver: false, | ||
}).start() | ||
} | ||
}, [props.mounted]) | ||
|
||
return ( | ||
<Animated.View | ||
style={[ | ||
{ | ||
backgroundColor: isLight ? "#000" : "#8791BD", | ||
height: props.height ?? 1, | ||
width: widthAnim, | ||
alignSelf: "center", | ||
}, | ||
props.style, | ||
]} | ||
/> | ||
) | ||
} |
This file contains 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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { PoliSearchBar } from "components/Home" | ||
import React, { FC, useState } from "react" | ||
import { View, ViewStyle } from "react-native" | ||
import { AnimatedLine } from "./AnimatedLine" | ||
|
||
export interface AnimatedPoliSearchBarProps { | ||
onSearch: (val: string) => void | ||
style?: ViewStyle | ||
} | ||
|
||
export const AnimatedPoliSearchBar: FC<AnimatedPoliSearchBarProps> = props => { | ||
const [isSearching, setIsSearching] = useState(false) | ||
return ( | ||
<View style={props.style}> | ||
<PoliSearchBar | ||
onChange={val => { | ||
props.onSearch(val) | ||
if (val !== "") { | ||
setIsSearching(true) | ||
} else if (isSearching === true) { | ||
setIsSearching(false) | ||
} | ||
}} | ||
style={{ marginTop: 0, marginBottom: 0 }} | ||
/> | ||
<AnimatedLine mounted={isSearching} /> | ||
</View> | ||
) | ||
} |
Oops, something went wrong.