Skip to content

Commit

Permalink
fix: event page (#204)
Browse files Browse the repository at this point in the history
* fix: event page

* fix: condiionally render lectures
 * manage roll number state
  • Loading branch information
Shurtu-gal authored Mar 16, 2023
1 parent 1a80d6a commit b270512
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 28 deletions.
9 changes: 8 additions & 1 deletion elaichi/lib/data/remote/graphql/graphql_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,14 @@ class GraphQLService {

Future<List<Org>> getOrgs() async {
try {
final result = await query(queryString: Queries.getOrgs);
final result = await query(
queryString: Queries.getOrgs,
variables: {
//change this to 0, 1 to get latest org after PR merge in backend
'pagination': {'skip': 1, 'take': 1},
'orgType': 'FEST'
},
);

final orgsList = (result.data!['org'] as List<dynamic>)
.map((e) => Org.fromJson(e as Map<String, dynamic>))
Expand Down
6 changes: 3 additions & 3 deletions elaichi/lib/data/remote/graphql/queries.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ class Queries {
}
''';

static const getOrgs = '''
query Org {
org {
static const getOrgs = r'''
query Org ($pagination: paginationInputType, $orgType: OrgType){
org(pagination: $pagination, orgType: $orgType){
id
name
description
Expand Down
47 changes: 29 additions & 18 deletions elaichi/lib/presentation/home/fest/explore/explore_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -177,28 +177,30 @@ class _ExplorePageState extends State<ExplorePage>
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Pro Shows',
'${categorisedEvents!.keys.toList()[0][0].toUpperCase()}${categorisedEvents.keys.toList()[0].substring(1).toLowerCase()}',
style: interTextTheme.headline2,
),
const SizedBox(height: 24),
HighPriorityEventList(
events: categorisedEvents!['PRO']!,
events:
categorisedEvents[categorisedEvents.keys.toList()[0]]!,
),
const SizedBox(height: 80),
Text(
'Technical Events',
'${categorisedEvents.keys.toList()[1][0].toUpperCase()}${categorisedEvents.keys.toList()[1].substring(1).toLowerCase()}',
style: interTextTheme.headline2,
),
const SizedBox(height: 24),
HighPriorityEventList(
events: categorisedEvents['TECHNICAL']!,
events:
categorisedEvents[categorisedEvents.keys.toList()[1]]!,
),
const SizedBox(height: 80),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Fun Events',
'${categorisedEvents.keys.toList()[2][0].toUpperCase()}${categorisedEvents.keys.toList()[2].substring(1).toLowerCase()}',
style: interTextTheme.headline2,
),
GestureDetector(
Expand All @@ -220,14 +222,15 @@ class _ExplorePageState extends State<ExplorePage>
),
const SizedBox(height: 24),
LowPriorityEventsList(
events: categorisedEvents['FUN']!,
events:
categorisedEvents[categorisedEvents.keys.toList()[2]]!,
),
const SizedBox(height: 80),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Exhibitions',
'${categorisedEvents.keys.toList()[3][0].toUpperCase()}${categorisedEvents.keys.toList()[3].substring(1).toLowerCase()}',
style: interTextTheme.headline2,
),
GestureDetector(
Expand All @@ -249,18 +252,26 @@ class _ExplorePageState extends State<ExplorePage>
),
const SizedBox(height: 24),
LowPriorityEventsList(
events: categorisedEvents['EXHIBITIONS']!,
),
const SizedBox(height: 80),
Text(
'Guest Lectures',
style: interTextTheme.headline2,
),
const SizedBox(height: 24),
SpeakerEventList(
events: categorisedEvents['GUEST-LECTURES ']!,
events:
categorisedEvents[categorisedEvents.keys.toList()[3]]!,
),
const SizedBox(height: 80),
if ((categorisedEvents['GUEST-LECTURES '] ??
categorisedEvents['WORKSHOPS'] ??
[])
.isNotEmpty) ...[
Text(
'Guest Lectures',
style: interTextTheme.headline2,
),
const SizedBox(height: 24),
SpeakerEventList(
events: categorisedEvents['GUEST-LECTURES '] ??
categorisedEvents['WORKSHOPS'] ??
[],
),
const SizedBox(height: 80),
],
Text(
'Our Schedule',
style: interTextTheme.headline2,
Expand All @@ -284,7 +295,7 @@ class _ExplorePageState extends State<ExplorePage>
class SpeakerEventList extends StatelessWidget {
const SpeakerEventList({
Key? key,
required this.events,
this.events = const [],
}) : super(key: key);

final List<Event> events;
Expand Down
7 changes: 1 addition & 6 deletions elaichi/lib/presentation/profile/bloc/profile_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
}) : _userRepository = userRepository,
_eventRepository = eventRepository,
super(const _Initial()) {
getRollNumber();
on<_WebMailLogOut>((event, emit) {
emit(const ProfileState.loading());
_userRepository.deleteWebMailDetails();
Expand All @@ -31,11 +30,7 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {

final UserRepository _userRepository;
final EventRepository _eventRepository;
String? rollNumber;

void getRollNumber() {
rollNumber = _userRepository.rollNumber;
}
String? get rollNumber => _userRepository.rollNumber;

bool get isZimraAuthenticated {
if (_userRepository.rollNumber != null) {
Expand Down

0 comments on commit b270512

Please sign in to comment.