Skip to content

Commit

Permalink
feat(science-clubs): connect isStrategic to directus
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-the-shark committed Jan 7, 2025
1 parent 57972c5 commit 57a29d2
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 89 deletions.
154 changes: 79 additions & 75 deletions lib/api_base/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ type Query {
Scientific_Circles_Links_by_id(id: ID!, version: String): Scientific_Circles_Links
Scientific_Circles_Links_aggregated(groupBy: [String], filter: Scientific_Circles_Links_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [Scientific_Circles_Links_aggregated!]!
Scientific_Circles_Links_by_version(version: String!, id: ID!): version_Scientific_Circles_Links
Scientific_Circles(filter: Scientific_Circles_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String): [Scientific_Circles!]!
Scientific_Circles_by_id(id: ID!, version: String): Scientific_Circles
Scientific_Circles_aggregated(groupBy: [String], filter: Scientific_Circles_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [Scientific_Circles_aggregated!]!
Scientific_Circles_by_version(version: String!, id: ID!): version_Scientific_Circles
Posts(filter: Posts_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String): [Posts!]!
Posts_by_id(id: ID!, version: String): Posts
Posts_aggregated(groupBy: [String], filter: Posts_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [Posts_aggregated!]!
Expand Down Expand Up @@ -85,6 +81,10 @@ type Query {
Changelog_Screenshots_by_id(id: ID!, version: String): Changelog_Screenshots
Changelog_Screenshots_aggregated(groupBy: [String], filter: Changelog_Screenshots_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [Changelog_Screenshots_aggregated!]!
Changelog_Screenshots_by_version(version: String!, id: ID!): version_Changelog_Screenshots
Scientific_Circles(filter: Scientific_Circles_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String): [Scientific_Circles!]!
Scientific_Circles_by_id(id: ID!, version: String): Scientific_Circles
Scientific_Circles_aggregated(groupBy: [String], filter: Scientific_Circles_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [Scientific_Circles_aggregated!]!
Scientific_Circles_by_version(version: String!, id: ID!): version_Scientific_Circles
}

type Scientific_Circles_Tags {
Expand All @@ -111,6 +111,7 @@ type Scientific_Circles {
department(filter: Departments_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String): Departments
desc2: String
useCoverAsPreviewPhoto: Boolean
isStrategic: Boolean!
tags(filter: Scientific_Circles_Tags_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String): [Scientific_Circles_Tags]
tags_func: count_functions
links(filter: Scientific_Circles_Links_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String): [Scientific_Circles_Links]
Expand Down Expand Up @@ -397,6 +398,7 @@ input Scientific_Circles_filter {
department: Departments_filter
desc2: string_filter_operators
useCoverAsPreviewPhoto: boolean_filter_operators
isStrategic: boolean_filter_operators
tags: Scientific_Circles_Tags_filter
tags_func: count_function_filter_operators
links: Scientific_Circles_Links_filter
Expand Down Expand Up @@ -610,70 +612,6 @@ type version_Scientific_Circles_Links {
scientific_circle_id: JSON
}

type Scientific_Circles_aggregated {
group: JSON
countAll: Int
count: Scientific_Circles_aggregated_count
countDistinct: Scientific_Circles_aggregated_count
avg: Scientific_Circles_aggregated_fields
sum: Scientific_Circles_aggregated_fields
avgDistinct: Scientific_Circles_aggregated_fields
sumDistinct: Scientific_Circles_aggregated_fields
min: Scientific_Circles_aggregated_fields
max: Scientific_Circles_aggregated_fields
}

type Scientific_Circles_aggregated_count {
id: Int
status: Int
sort: Int
date_created: Int
date_updated: Int
name: Int
logo: Int
cover: Int
description: Int
type: Int
source: Int
shortDescription: Int
department: Int
desc2: Int
useCoverAsPreviewPhoto: Int
tags: Int
links: Int
}

type Scientific_Circles_aggregated_fields {
id: Float
sort: Float
department: Float
}

""""""
type version_Scientific_Circles {
id: ID!
status: String
sort: Int
date_created: Date
date_created_func: datetime_functions
date_updated: Date
date_updated_func: datetime_functions
name: String!
logo: JSON
cover: JSON
description: String
type: String
source: String
shortDescription: String
department: JSON
desc2: String
useCoverAsPreviewPhoto: Boolean
tags: JSON
tags_func: count_functions
links: JSON
links_func: count_functions
}

type Posts_aggregated {
group: JSON
countAll: Int
Expand Down Expand Up @@ -1610,13 +1548,78 @@ type version_Changelog_Screenshots {
screenshot_preview: JSON
}

type Scientific_Circles_aggregated {
group: JSON
countAll: Int
count: Scientific_Circles_aggregated_count
countDistinct: Scientific_Circles_aggregated_count
avg: Scientific_Circles_aggregated_fields
sum: Scientific_Circles_aggregated_fields
avgDistinct: Scientific_Circles_aggregated_fields
sumDistinct: Scientific_Circles_aggregated_fields
min: Scientific_Circles_aggregated_fields
max: Scientific_Circles_aggregated_fields
}

type Scientific_Circles_aggregated_count {
id: Int
status: Int
sort: Int
date_created: Int
date_updated: Int
name: Int
logo: Int
cover: Int
description: Int
type: Int
source: Int
shortDescription: Int
department: Int
desc2: Int
useCoverAsPreviewPhoto: Int
isStrategic: Int
tags: Int
links: Int
}

type Scientific_Circles_aggregated_fields {
id: Float
sort: Float
department: Float
}

""""""
type version_Scientific_Circles {
id: ID!
status: String
sort: Int
date_created: Date
date_created_func: datetime_functions
date_updated: Date
date_updated_func: datetime_functions
name: String!
logo: JSON
cover: JSON
description: String
type: String
source: String
shortDescription: String
department: JSON
desc2: String
useCoverAsPreviewPhoto: Boolean
isStrategic: Boolean!
tags: JSON
tags_func: count_functions
links: JSON
links_func: count_functions
}

type Subscription {
directus_files_mutated(event: EventEnum): directus_files_mutated
Scientific_Circles_Tags_mutated(event: EventEnum): Scientific_Circles_Tags_mutated
Tags_mutated(event: EventEnum): Tags_mutated
Posts_Tags_mutated(event: EventEnum): Posts_Tags_mutated
Scientific_Circles_Links_mutated(event: EventEnum): Scientific_Circles_Links_mutated
Scientific_Circles_mutated(event: EventEnum): Scientific_Circles_mutated
Posts_mutated(event: EventEnum): Posts_mutated
AcademicCalendarData_mutated(event: EventEnum): AcademicCalendarData_mutated
WeekExceptions_mutated(event: EventEnum): WeekExceptions_mutated
Expand All @@ -1635,6 +1638,7 @@ type Subscription {
Changelog_mutated(event: EventEnum): Changelog_mutated
Changelog_Change_mutated(event: EventEnum): Changelog_Change_mutated
Changelog_Screenshots_mutated(event: EventEnum): Changelog_Screenshots_mutated
Scientific_Circles_mutated(event: EventEnum): Scientific_Circles_mutated
}

type directus_files_mutated {
Expand Down Expand Up @@ -1673,12 +1677,6 @@ type Scientific_Circles_Links_mutated {
data: Scientific_Circles_Links
}

type Scientific_Circles_mutated {
key: ID!
event: EventEnum
data: Scientific_Circles
}

type Posts_mutated {
key: ID!
event: EventEnum
Expand Down Expand Up @@ -1785,4 +1783,10 @@ type Changelog_Screenshots_mutated {
key: ID!
event: EventEnum
data: Changelog_Screenshots
}

type Scientific_Circles_mutated {
key: ID!
event: EventEnum
data: Scientific_Circles
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class _ScienceClubsList extends ConsumerWidget {
: sciClub.logo?.filename_disk,
onClick: () async => ref.navigateSciClubsDetail(sciClub.id),
showVerifiedBadge: sciClub.source == ScienceClubsViewConfig.source,
showStrategicBadge: true,
showStrategicBadge: sciClub.isStrategic,
),
);
},
Expand Down
14 changes: 5 additions & 9 deletions lib/features/home_view/widgets/science_clubs_section.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ class _ScienceClubsDataList extends ConsumerWidget {
itemCount: scienceClubs.length,
itemBuilder: (BuildContext context, int index) {
final sciClub = scienceClubs[index];
final sciClubCard = _BuildScienceClubCard(sciClub: sciClub, ref: ref);

final sciClubCard = _ScienceClubCard(sciClub: sciClub);
if (index != scienceClubs.length - 1) {
return MediumLeftPadding(
child: sciClubCard,
Expand All @@ -87,17 +86,13 @@ class _ScienceClubsDataList extends ConsumerWidget {
}
}

class _BuildScienceClubCard extends StatelessWidget {
const _BuildScienceClubCard({
required this.sciClub,
required this.ref,
});
class _ScienceClubCard extends ConsumerWidget {
const _ScienceClubCard({required this.sciClub});

final ScienceClub sciClub;
final WidgetRef ref;

@override
Widget build(BuildContext context) {
Widget build(BuildContext context, WidgetRef ref) {
return BigPreviewCard(
title: sciClub.name,
shortDescription: sciClub.shortDescription ?? "",
Expand All @@ -106,6 +101,7 @@ class _BuildScienceClubCard extends StatelessWidget {
: sciClub.logo?.filename_disk,
showVerifiedBadge: sciClub.source == ScienceClubsViewConfig.source,
onClick: () async => ref.navigateSciClubsDetail(sciClub.id),
showStrategicBadge: sciClub.isStrategic,
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ query GetScienceClubDetails($id: ID!) {
department {
name
}
isStrategic
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class _SciClubDetailDataView extends ConsumerWidget {
children: [
if (value.source == ScienceClubsViewConfig.source)
const VerifiedBadge(),
const StrategicBadge(),
if (value.isStrategic) const StrategicBadge(),
],
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ query GetScienceClubs {
filename_disk
}
useCoverAsPreviewPhoto
isStrategic
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ScienceClubCard extends StatelessWidget {
.toList()
.join(", "),
showBadge: sciClub.source == ScienceClubsViewConfig.source,
showStrategicBadge: true,
showStrategicBadge: sciClub.isStrategic,
activeShadows: null,
trailing: Padding(
padding: const EdgeInsets.only(
Expand Down
3 changes: 2 additions & 1 deletion lib/features/science_clubs_view/widgets/strategic_badge.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import "package:flutter/material.dart";

import "../../../theme/app_theme.dart";
import "../../../utils/context_extensions.dart";

class StrategicBadge extends WidgetSpan {
const StrategicBadge()
Expand All @@ -20,7 +21,7 @@ class _StrategicBadgeWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Tooltip(
message: "Koło strategiczne PWr",
message: context.localize.strategicBadgeTooltip,
child: Stack(
children: [
Center(
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/wide_tile_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class _TitlesColumn extends StatelessWidget {
: context.textTheme.bodyBlue,
maxTotalLines: 4,
showVerifiedBadge: showBadge,
showStrategicBadge: true,
showStrategicBadge: showStrategicBadge,
),
);
},
Expand Down

0 comments on commit 57a29d2

Please sign in to comment.