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

[Bazaar] add back end to bazaar mainpage #1265

Merged
merged 35 commits into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a56157f
first commit of Bazaar main page
SourbaevaJanaraJ May 19, 2023
c4334f7
changed BazaarMain () UI and UX
SourbaevaJanaraJ May 20, 2023
198efcd
added translation
SourbaevaJanaraJ May 22, 2023
f1ebbb9
added textColor for highlight and neubeileu, highlight on the top
SourbaevaJanaraJ May 23, 2023
a6c7620
pulled master branch
SourbaevaJanaraJ May 23, 2023
6b7f606
deleted comment
SourbaevaJanaraJ May 24, 2023
ae92b2e
changed communityChoose to more informal format, and moved required a…
SourbaevaJanaraJ May 31, 2023
67e8861
testing bazaar back end, not finished
azackmatoff May 31, 2023
8dd7abb
pulled master branch and solved all the conflicts
SourbaevaJanaraJ May 31, 2023
c1f06d2
deleted single_business model
SourbaevaJanaraJ Jun 1, 2023
41b8cd3
changed BazaarPage to BazaarMain
SourbaevaJanaraJ Jun 1, 2023
e7597f7
not finished, returning data has to be changed
azackmatoff Jun 2, 2023
d7f8385
pulled master branch, and did small refactoring of the elevated Butto…
SourbaevaJanaraJ Jun 2, 2023
b21dac1
pulled master branch
SourbaevaJanaraJ Jun 5, 2023
2c5e4ad
@JsonValue to snake_case
SourbaevaJanaraJ Jun 5, 2023
7104849
pulled master branch
SourbaevaJanaraJ Jun 5, 2023
268873c
deleted CustomElevatedButton()
SourbaevaJanaraJ Jun 6, 2023
c933753
try fix 01
Eldar2021 Jun 7, 2023
84fd1bb
Merge branch 'el/try-fix-bazaar-overflow-errors' into Bazaar---Add-ba…
azackmatoff Jun 9, 2023
213af98
Sort not done yet
azackmatoff Jun 10, 2023
8cceb14
filter by categories done
azackmatoff Jun 12, 2023
7541e10
Merge branch 'master' into Bazaar---Add-back-end-to-bazaars-mainpage
azackmatoff Jun 12, 2023
00d5add
fixed some errors
azackmatoff Jun 12, 2023
a852ad3
Merge branch 'master' into Bazaar---Add-back-end-to-bazaars-mainpage
azackmatoff Jun 15, 2023
da8f9ba
fixed analyze check fails
azackmatoff Jun 15, 2023
3cdf052
added comment regarding EdisonPaula
azackmatoff Jul 11, 2023
968cae1
after code review changes made
azackmatoff Jul 11, 2023
423c6c7
Merge branch 'master' into Bazaar---Add-back-end-to-bazaars-mainpage
azackmatoff Jul 12, 2023
6af4ea2
fixed dropdown menu ui
azackmatoff Jul 12, 2023
bf01df6
unit test failures fixed, which closes 1331
azackmatoff Jul 12, 2023
5425553
[mock_bazaar_data] fix remaining unicode error.
clangenb Jul 14, 2023
8c01c9f
[transfer_history_view] fix merge error
clangenb Jul 14, 2023
4709d90
[businesses_store] fix typo
clangenb Jul 14, 2023
b4ad75c
Merge branch 'master' into Bazaar---Add-back-end-to-bazaars-mainpage
clangenb Jul 14, 2023
11709d5
Merge branch 'master' into Bazaar---Add-back-end-to-bazaars-mainpage
clangenb Jul 14, 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
1 change: 1 addition & 0 deletions app/lib/common/components/logo/community_icon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class CommunityIconObserver extends StatelessWidget {
return SvgPicture.asset(fallBackCommunityIcon);
}
} else {
///TODO(Azamat): Add some image saying community not selected
azackmatoff marked this conversation as resolved.
Show resolved Hide resolved
return const CupertinoActivityIndicator();
}
},
Expand Down
2 changes: 1 addition & 1 deletion app/lib/common/components/map/encointer_map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class EncointerMap extends StatelessWidget {
required this.popupBuilder,
required this.locations,
this.initialZoom = 13,
this.maxZoom = 18,
this.maxZoom = 20,
this.center,
this.mapController,
this.onPointerDown,
Expand Down
1 change: 1 addition & 0 deletions app/lib/config/consts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ String ceremonyInfoLink(String locale, String? cid) {

const assignmentFAQLinkEN = 'https://leu.zuerich/en/#why-have-i-not-been-assigned-to-a-cycle';
const assignmentFAQLinkDE = 'https://leu.zuerich/#warum-wurde-ich-keinem-cycle-zugewiesen';
const infuraIpfsUrl = 'https://encointer.infura-ipfs.io/ipfs';

String leuZurichCycleAssignmentFAQLink(String locale) {
return switch (locale) {
Expand Down
19 changes: 19 additions & 0 deletions app/lib/mocks/mock_bazaar_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ const String businessIpfsCid3 = '0x3ebf164a5bb618ec6caad31488161b237e24d75efa304
final CommunityIdentifier cid1 = CommunityIdentifier.fromFmtString('gbsuv7YXq9G');
final CommunityIdentifier cid2 = CommunityIdentifier.fromFmtString('fbsuv7YXq9G');

/// EdisonPaula
final CommunityIdentifier cidEdisonPaula = CommunityIdentifier.fromFmtString('u0qj94fxxJ6');

final BusinessIdentifier bid1 = BusinessIdentifier(cid1, controller1);
final BusinessIdentifier bid2 = BusinessIdentifier(cid1, controller2);
final BusinessIdentifier bid3 = BusinessIdentifier(cid1, controller3);
Expand Down Expand Up @@ -96,3 +99,19 @@ final ipfsOffering3 = IpfsOffering('Harry Potter Heptalogy', 1, 'I am interestin
'assets/images/assets/assets_nav_0.png');
final ipfsOffering4 = IpfsOffering(
'Picasso Fake as NFT by C.L.', 1, 'I am beautiful', 'Miami Beach', 'assets/images/assets/assets_nav_0.png');

final mockBusinessData = {
'name': 'HIGHLIGHTED',
'description': 'wir offerieren kühles Bier',
'category': 'food',
'photo': null,
'address': 'Technoparkstrasse 1, 8005 Zürich',
'telephone': null,
'email': null,
'longitude': '8.515377938747404',
'latitude': '47.389401263868514',
'openingHours': 'Mon-Fri 8h-18h',
'photos': 'QmaQfq6Zr2yCMkSMe8VjSxoYd89hyzcJjeE8jTUG3uXpBG',
'logo': 'QmcULG6AN5wwMfuwtpsMcjQmFwwUnSHsvSEUFLrCoWMpWh',
'status': 'highlight',
};
109 changes: 75 additions & 34 deletions app/lib/models/bazaar/businesses.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
import 'package:encointer_wallet/page-encointer/new_bazaar/businesses/widgets/dropdown_widget.dart';
import 'package:flutter/material.dart';
import 'package:json_annotation/json_annotation.dart';

import 'package:encointer_wallet/config/consts.dart';
import 'package:encointer_wallet/page-encointer/new_bazaar/businesses/widgets/dropdown_widget.dart';

part 'businesses.g.dart';

@JsonSerializable()
class Businesses {
const Businesses({
Businesses({
required this.name,
required this.description,
required this.category,
required this.photo,
required this.address,
required this.longitude,
required this.latitude,
required this.openingHours,
this.logo,
this.photos,
this.photo,
this.telephone,
this.email,
this.status,
});
factory Businesses.fromJson(Map<String, dynamic> json) => _$BusinessesFromJson(json);
Expand All @@ -19,13 +29,22 @@ class Businesses {
final String name;
final String description;
final Category category;
final String photo;
final String? photo;
final String address;
final String? telephone;
final String? email;
final String longitude;
final String latitude;
final String openingHours;
String? photos;
@ImageHashToLinkOrNullConverter()
String? logo;
final Status? status;
Color get statusColor {
switch (status) {
case Status.highlight:
return const Color(0xFFE8FBFF);
case Status.neuBeiLeu:
case Status.recently:
return Colors.lightGreen.shade100;
// ignore: no_default_cases
default:
Expand All @@ -34,11 +53,23 @@ class Businesses {
}
}

class ImageHashToLinkOrNullConverter implements JsonConverter<String?, String?> {
const ImageHashToLinkOrNullConverter();

@override
String? fromJson(String? value) {
return '$infuraIpfsUrl/$value';
}

@override
String? toJson(String? val) => val;
}

enum Status {
@JsonValue('highlight')
highlight('Highlight', Color(0xFF00A3FF)),
@JsonValue('neu_bei_leu')
neuBeiLeu('Neu bei Leu', Color(0xFF00BA77));
@JsonValue('new')
recently('New', Color(0xFF00BA77));

const Status(
this.name,
Expand All @@ -55,39 +86,49 @@ enum Status {
const businessesMockData = {
'businesses': [
{
'name': 'Yoga-Kurse mit Hatha Lisa',
'description': 'Nutze deine Leu, um deinem Körper und Geist etwas Gutes zu tun. ...',
'category': 'body_soul',
'photo': 'https://github.com/SourbaevaJanaraJ/lock_screen/blob/master/assets/hatha-lisa.png?raw=true',
'status': 'highlight'
},
{
'name': 'Hardi – Kafi am Tag, Kultur am Abend und zwischen ...',
'description': 'Herzhaft unkompliziert empfängt das Hardi seine Gäste im ...',
'category': 'food_beverage_store',
'photo': 'https://github.com/SourbaevaJanaraJ/lock_screen/blob/master/assets/hatha-lisa-02.png?raw=true',
'status': 'highlight'
'name': 'HIGHLIGHTED',
'description': 'wir offerieren kühles Bier',
'category': 'food',
'photo': null,
'address': 'Technoparkstrasse 1, 8005 Zürich',
'telephone': null,
'email': null,
'longitude': '8.515377938747404',
'latitude': '47.389401263868514',
'openingHours': 'Mon-Fri 8h-18h',
'photos': 'QmaQfq6Zr2yCMkSMe8VjSxoYd89hyzcJjeE8jTUG3uXpBG',
'logo': 'QmcULG6AN5wwMfuwtpsMcjQmFwwUnSHsvSEUFLrCoWMpWh',
'status': 'highlight',
},
{
'name': 'KAOZ',
'description': 'Wir sind KAOZ. Das heisst: kreativ, authentisch, optimistisch und ...',
'name': 'NEW',
'description': 'wir offerieren kühles Bier',
'category': 'fashion_clothing',
'photo': 'https://github.com/SourbaevaJanaraJ/lock_screen/blob/master/assets/hatha-lisa-02%20(1).png?raw=true'
},
{
'name': 'GRRRR',
'description': 'Papierware, Zines, Bücher, Zeichnungen aus Züri und anders...',
'category': 'art_music',
'photo':
'https://github.com/SourbaevaJanaraJ/lock_screen/blob/master/assets/hatha-lisa-02%20(1)%203.png?raw=true',
'status': 'neu_bei_leu'
'photo': null,
'address': 'Technoparkstrasse 1, 8005 Zürich',
'telephone': null,
'email': null,
'longitude': '8.515377938747404',
'latitude': '47.389401263868514',
'openingHours': 'Mon-Fri 8h-18h',
'photos': 'QmaQfq6Zr2yCMkSMe8VjSxoYd89hyzcJjeE8jTUG3uXpBG',
'logo': 'QmcULG6AN5wwMfuwtpsMcjQmFwwUnSHsvSEUFLrCoWMpWh',
'status': 'new',
},
{
'name': 'Sørenbrød',
'description': 'Der Künstler Søren Berner (geb. 1977 in Dänemark) begann 1999, als er ...',
'name': 'NORMAL',
'description': 'wir offerieren kühles Bier',
'category': 'food_beverage_store',
'photo': 'https://github.com/SourbaevaJanaraJ/lock_screen/blob/master/assets/sorenbrod.png?raw=true',
'status': 'neu_bei_leu'
'photo': null,
'address': 'Technoparkstrasse 1, 8005 Zürich',
'telephone': null,
'email': null,
'longitude': '8.515377938747404',
'latitude': '47.389401263868514',
'openingHours': 'Mon-Fri 8h-18h',
'photos': 'QmaQfq6Zr2yCMkSMe8VjSxoYd89hyzcJjeE8jTUG3uXpBG',
'logo': 'QmcULG6AN5wwMfuwtpsMcjQmFwwUnSHsvSEUFLrCoWMpWh',
'status': null,
}
]
};
21 changes: 19 additions & 2 deletions app/lib/models/bazaar/businesses.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/lib/modules/transfer/view/transfer_history_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class TransferHistoryView extends StatelessWidget {
context.read<TransferHistoryViewStore>().getTransfers(appStore);
},
),
FetchStatus.noData => const SizedBox.shrink(),
};
}),
),
Expand Down
42 changes: 29 additions & 13 deletions app/lib/page-encointer/bazaar/0_main/bazaar_main.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:encointer_wallet/models/communities/community_identifier.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

Expand All @@ -7,8 +8,35 @@ import 'package:encointer_wallet/page-encointer/new_bazaar/businesses/widgets/dr
import 'package:encointer_wallet/theme/custom/extension/theme_extension.dart';
import 'package:encointer_wallet/l10n/l10.dart';

class BazaarMainArgs {
BazaarMainArgs({required this.cid});
final CommunityIdentifier cid;
}

class BazaarMain extends StatelessWidget {
const BazaarMain({
required this.args,
super.key,
});
final BazaarMainArgs args;

@override
Widget build(BuildContext context) {
return Provider(
create: (context) => BusinessesStore(args.cid)..getBusinesses(),
child: BazaarPage(
cid: args.cid,
),
);
}
}

class BazaarPage extends StatelessWidget {
const BazaarPage({super.key});
const BazaarPage({
super.key,
required this.cid,
});
final CommunityIdentifier cid;
static const String route = '/bazaar';

@override
Expand Down Expand Up @@ -49,15 +77,3 @@ class BazaarPage extends StatelessWidget {
);
}
}

class BazaarMain extends StatelessWidget {
const BazaarMain({super.key});

@override
Widget build(BuildContext context) {
return Provider(
create: (context) => BusinessesStore()..getBusinesses(),
child: const BazaarPage(),
);
}
}
7 changes: 7 additions & 0 deletions app/lib/page-encointer/common/community_chooser_on_map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ List<LatLng> getLocations(AppStore store) {
}

LatLng coordinatesOf(CidName community) {
/// EdisonPaula has similar map data as to Leu
/// thus it is too close to Zurich Leu,
/// and very hard to choose it from map
/// thus moved little bit to the left on map
if (community.name == 'EdisonPaula') {
return LatLng(47.3962467, 8.4815019);
}
final coordinates = GeoHash(utf8.decode(community.cid.geohash));
return LatLng(coordinates.latitude(), coordinates.longitude());
}
Expand Down
Loading
Loading