Skip to content
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

merge dev #1018

Merged
merged 43 commits into from
Dec 27, 2023
Merged
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
9b7b9fb
[Feat-885] Add selection for stack bar graphs (#935)
shaked-hayek Nov 26, 2022
15ff26a
add conditional label, refactor utils (#938)
danielsh28 Nov 26, 2022
57e0788
Update .env.staging (#947)
atalyaalon Feb 8, 2023
1a372a2
Add critical indication (#948)
carmelp16 Mar 1, 2023
dcdb07d
add alt attrinbte on image tag (#951)
EyalIlan Mar 3, 2023
a3833ea
Update .env.staging (#952)
atalyaalon Mar 5, 2023
8c0fd68
Make critical filter non local (#958)
carmelp16 Mar 22, 2023
4e536ab
Update News.tsx (#961)
atalyaalon Apr 25, 2023
dd9febf
Update news-flash-store.ts (#962)
atalyaalon Apr 25, 2023
7b67d07
Update News.tsx
atalyaalon Apr 25, 2023
a06502e
Update thank-you-names.csv
atalyaalon May 29, 2023
61a492e
transaction dialog box (#966)
atalyaalon Jun 24, 2023
78a9b5d
Merge branch 'master' into dev
atalyaalon Jun 24, 2023
c0132b1
[Feat-925] Add location approval feature (#969)
shaked-hayek Jul 12, 2023
63826f0
Feature add transcrption 4 widgets 957 (#968)
EyalIlan Jul 13, 2023
54922d7
Merge branch 'master' into dev
atalyaalon Jul 13, 2023
f6e4673
add widget vision_10_30_90 (#972)
EyalIlan Aug 2, 2023
0eeb69a
Feature widget vision zero 10 50 90 (#975)
EyalIlan Aug 2, 2023
6cc8984
Merge branch 'master' into dev
atalyaalon Aug 2, 2023
97794f6
change the location of the start command in package.json (#977)
Shai2022 Aug 16, 2023
95ed077
add logo (#979)
atalyaalon Aug 29, 2023
f37a40f
add natun square logo (#982)
atalyaalon Sep 4, 2023
6b0c6c3
add widget lower bar (#981)
EyalIlan Sep 5, 2023
9101077
Merge branch 'master' into dev
atalyaalon Sep 5, 2023
69fb2af
update logo (#980)
atalyaalon Sep 8, 2023
3eb5bcb
Update Footer.tsx (#986)
atalyaalon Sep 8, 2023
f3fb4b9
add data-for-change (#988)
atalyaalon Sep 8, 2023
f09d197
Delete src/assets/hasadna.png (#989)
atalyaalon Sep 8, 2023
672afe7
Merge branch 'master' into dev
atalyaalon Sep 8, 2023
93ecda1
Bug click twice to change news backround (#984)
EyalIlan Sep 13, 2023
f659f41
Add dev-to-prod auth server change (#950)
BarVolunteering Sep 27, 2023
24e2992
Spliting title and subtitle, making title bold (#995)
shaked-hayek Dec 24, 2023
d432d0e
Change design in bar widgets (#996)
shaked-hayek Dec 24, 2023
19f4cea
Remove margin from bottom of bar charts (#1001)
shaked-hayek Dec 26, 2023
ce668f8
Add check for user authentication in NewsFlash (#990) (#1003)
shaked-hayek Dec 26, 2023
21b0955
Merge branch 'master' into dev
atalyaalon Dec 26, 2023
9d1cabb
Fix subtitle param in CardEditor (#1005) (#1006)
shaked-hayek Dec 26, 2023
ab01c7c
Remove padding from bottom of stack bars (#1008) (#1009)
shaked-hayek Dec 27, 2023
81875d9
Open new widgets to production (#1012) (#1013)
shaked-hayek Dec 27, 2023
8ab2fdb
Remove accident_count_by_driver_type from prod (#1016)
shaked-hayek Dec 27, 2023
b1c22e7
Merge branch 'master' into dev
atalyaalon Dec 27, 2023
69fb2ee
Update cards.const.ts
atalyaalon Dec 27, 2023
a8b248a
Add title and subtitle to heatmap widget (#1015)
shaked-hayek Dec 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make critical filter non local (#958)
* sufficient condition

* Use object for fetch args

* Send params in object format

* Make fields optional

* don't use "any" type hint
  • Loading branch information
carmelp16 authored Mar 22, 2023
commit 8c0fd687dd35103c971168d0ff7892b7d54a7629
2 changes: 1 addition & 1 deletion src/components/organisms/News.tsx
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ const News: FC = () => {
{date}, {news.display_source}
</Typography.Body5>
</p>
{(news.hasOwnProperty('critical') && news.critical) && <img src={CriticalIcon} alt="" style={{ height: "30px", width: "30px", mixBlendMode: "multiply" }} />}
{news.critical && <img src={CriticalIcon} style={{ height: "30px", width: "30px", mixBlendMode: "multiply" }} />}
</Box>
<Typography.Body5>{news.title}</Typography.Body5>
</Box>
11 changes: 10 additions & 1 deletion src/services/news.data.service.ts
Original file line number Diff line number Diff line change
@@ -17,15 +17,24 @@ const errorNews: INewsFlash = {
};

const NEWS_FLASH_API: string = '/api/news-flash';
export interface IFetchNewsQueryParams {
source?: string;
offSet?: number;
limit?: number;
critical?: boolean | null;
};

export function fetchNews(source = '', offSet = 0, limit = 100): Promise<any> {
export function fetchNews({source = '', offSet = 0, limit = 100, critical = null}: IFetchNewsQueryParams = {}): Promise<any> {
const query = [];
if (source) {
query.push(`source=${source}`);
}
if (limit) {
query.push(`limit=${limit}`);
}
if (critical !== null) {
query.push(`critical=${critical}`);
}
query.push(`offset=${offSet}`);

query.push('resolution=suburban_road');
20 changes: 11 additions & 9 deletions src/store/news-flash-store.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import { runInAction, makeAutoObservable } from 'mobx';
import { SourceFilterEnum } from 'models/SourceFilter';
import { fetchNews } from 'services/news.data.service';
import { fetchNews, IFetchNewsQueryParams } from 'services/news.data.service';
import { INewsFlash } from 'models/NewFlash';
import { IPoint } from 'models/Point';
import RootStore from './root.store';

function filterByCritical(newsFlashCollection: Array<INewsFlash>): Array<INewsFlash> {
return newsFlashCollection.filter(news => news.hasOwnProperty("critical") && news.critical);
}

const DEFAULT_TIME_FILTER = 5;
const DEFAULT_LOCATION = { latitude: 32.0853, longitude: 34.7818 };
const LOCAL_FILTERS: { [key in SourceFilterEnum]?: (newsFlashCollection: Array<INewsFlash>) => Array<INewsFlash> } = {
[SourceFilterEnum.critical]: filterByCritical
}
const LOCAL_FILTERS: { [key in SourceFilterEnum]?: (newsFlashCollection: Array<INewsFlash>) => Array<INewsFlash> } = {};

export default class NewsFlashStore {
rootStore: RootStore;
@@ -114,7 +108,15 @@ export default class NewsFlashStore {
runInAction(() => (this.newsFlashCollection = [...(filtered || [])]));
runInAction(() => (this.newsFlashLoading = false));
} else {
fetchNews(this.newsFlashActiveFilter, this.newsFlashFetchOffSet).then((data: any) => {
const queryParams: IFetchNewsQueryParams = {
offSet: this.newsFlashFetchOffSet
};
if (this.newsFlashActiveFilter == "critical") {
queryParams["critical"] = true;
} else {
queryParams["source"] = this.newsFlashActiveFilter;
}
fetchNews(queryParams).then((data: any) => {
runInAction(() => (this.newsFlashLoading = false));
if (data) {
runInAction(() => (this.newsFlashCollection = [...this.newsFlashCollection, ...data]));