-
Notifications
You must be signed in to change notification settings - Fork 7
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
fix: make curator note nullable #2342
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 |
---|---|---|
|
@@ -79,9 +79,12 @@ class _ExhibitionDetailPageState extends State<ExhibitionDetailPage> | |
return const LoadingWidget(); | ||
} | ||
|
||
final shouldShowNotePage = exhibition.shouldShowCuratorNotePage; | ||
// if exhibition is not minted, show only preview page | ||
final itemCount = | ||
!exhibition.isMinted ? 3 : ((exhibition.displayableSeries.length) + 3); | ||
final exhibitionInfoCount = shouldShowNotePage ? 2 : 3; | ||
final itemCount = !exhibition.isMinted | ||
? exhibitionInfoCount | ||
: ((exhibition.displayableSeries.length) + exhibitionInfoCount); | ||
return Column( | ||
children: [ | ||
Expanded( | ||
|
@@ -113,25 +116,15 @@ class _ExhibitionDetailPageState extends State<ExhibitionDetailPage> | |
case 0: | ||
return _getPreviewPage(exhibition); | ||
case 1: | ||
return _notePage(exhibition); | ||
default: | ||
final seriesIndex = index - 2; | ||
final series = | ||
exhibition.displayableSeries.sorted[seriesIndex]; | ||
final artwork = series.artwork; | ||
if (artwork == null) { | ||
return const SizedBox(); | ||
if (shouldShowNotePage) { | ||
return _notePage(exhibition); | ||
} else { | ||
final seriesIndex = index - (exhibitionInfoCount - 1); | ||
return _getSeriesPreviewPage(seriesIndex, exhibition); | ||
} | ||
return Padding( | ||
padding: const EdgeInsets.only(bottom: 40), | ||
child: FeralFileArtworkPreview( | ||
key: Key('feral_file_artwork_preview_${artwork.id}'), | ||
payload: FeralFileArtworkPreviewPayload( | ||
artwork: artwork.copyWith( | ||
series: series.copyWith(exhibition: exhibition)), | ||
), | ||
), | ||
); | ||
default: | ||
final seriesIndex = index - (exhibitionInfoCount - 1); | ||
return _getSeriesPreviewPage(seriesIndex, exhibition); | ||
} | ||
}, | ||
), | ||
|
@@ -141,6 +134,24 @@ class _ExhibitionDetailPageState extends State<ExhibitionDetailPage> | |
); | ||
} | ||
|
||
Widget _getSeriesPreviewPage(int seriesIndex, Exhibition exhibition) { | ||
final series = exhibition.displayableSeries.sorted[seriesIndex]; | ||
final artwork = series.artwork; | ||
if (artwork == null) { | ||
return const SizedBox(); | ||
} | ||
return Padding( | ||
padding: const EdgeInsets.only(bottom: 40), | ||
child: FeralFileArtworkPreview( | ||
key: Key('feral_file_artwork_preview_${artwork.id}'), | ||
payload: FeralFileArtworkPreviewPayload( | ||
artwork: | ||
artwork.copyWith(series: series.copyWith(exhibition: exhibition)), | ||
), | ||
), | ||
); | ||
} | ||
|
||
void _sendMetricViewExhibition() { | ||
final exhibition = _exBloc.state.exhibition; | ||
if (exhibition == null) { | ||
|
@@ -154,8 +165,8 @@ class _ExhibitionDetailPageState extends State<ExhibitionDetailPage> | |
if (request.catalog == ExhibitionCatalog.artwork) | ||
MetricParameter.tokenId: request.catalogId, | ||
}; | ||
injector<MetricClientService>() | ||
.addEvent(MetricEventName.exhibitionView, data: data); | ||
unawaited(injector<MetricClientService>() | ||
.addEvent(MetricEventName.exhibitionView, data: data)); | ||
} | ||
|
||
void _stream(Exhibition exhibition) { | ||
|
@@ -265,22 +276,30 @@ class _ExhibitionDetailPageState extends State<ExhibitionDetailPage> | |
Exhibition exhibition) { | ||
ExhibitionCatalog? catalog; | ||
String? catalogId; | ||
final shouldShowNotePage = exhibition.shouldShowCuratorNotePage; | ||
final exhibitionInfoCount = shouldShowNotePage ? 2 : 3; | ||
switch (_currentIndex) { | ||
case 0: | ||
catalog = ExhibitionCatalog.home; | ||
case 1: | ||
if (_carouselIndex == 0) { | ||
catalog = ExhibitionCatalog.curatorNote; | ||
if (shouldShowNotePage) { | ||
if (_carouselIndex == 0) { | ||
catalog = ExhibitionCatalog.curatorNote; | ||
} else { | ||
catalog = ExhibitionCatalog.resource; | ||
catalogId = exhibition.allResources[_carouselIndex - 1].id; | ||
} | ||
} else { | ||
catalog = ExhibitionCatalog.resource; | ||
catalogId = exhibition.allResources[_carouselIndex - 1].id; | ||
catalog = ExhibitionCatalog.artwork; | ||
final seriesIndex = _currentIndex - (exhibitionInfoCount - 1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same with above comment |
||
catalogId = | ||
exhibition.displayableSeries.sorted[seriesIndex].artwork?.id; | ||
} | ||
default: | ||
catalog = ExhibitionCatalog.artwork; | ||
final seriesIndex = _currentIndex - 2; | ||
final currentArtwork = | ||
final seriesIndex = _currentIndex - (exhibitionInfoCount - 1); | ||
catalogId = | ||
exhibition.displayableSeries.sorted[seriesIndex].artwork?.id; | ||
catalogId = currentArtwork; | ||
} | ||
return Pair(catalog, catalogId); | ||
} | ||
|
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 |
---|---|---|
|
@@ -36,40 +36,44 @@ class ExhibitionNoteView extends StatelessWidget { | |
style: theme.textTheme.ppMori400White12, | ||
), | ||
const SizedBox(height: 30), | ||
Text( | ||
exhibition.noteTitle, | ||
style: theme.textTheme.ppMori700White14, | ||
), | ||
const SizedBox(height: 20), | ||
ConstrainedBox( | ||
constraints: const BoxConstraints(maxHeight: 400), | ||
child: HtmlWidget( | ||
customStylesBuilder: auHtmlStyle, | ||
exhibition.noteBrief, | ||
textStyle: theme.textTheme.ppMori400White14, | ||
onTapUrl: (url) async { | ||
await launchUrl(Uri.parse(url), | ||
mode: LaunchMode.externalApplication); | ||
return true; | ||
}, | ||
if (exhibition.noteTitle?.isNotEmpty == true) ...[ | ||
Text( | ||
exhibition.noteTitle!, | ||
style: theme.textTheme.ppMori700White14, | ||
), | ||
), | ||
if (exhibition.noteBrief != exhibition.note) ...[ | ||
const SizedBox(height: 20), | ||
GestureDetector( | ||
onTap: () async { | ||
await injector<NavigationService>() | ||
.openFeralFileExhibitionNotePage(exhibition.slug); | ||
}, | ||
child: Text( | ||
'read_more'.tr(), | ||
style: theme.textTheme.ppMori400White14.copyWith( | ||
decoration: TextDecoration.underline, | ||
decorationColor: AppColor.white, | ||
), | ||
], | ||
if (exhibition.noteBrief?.isNotEmpty == true) ...[ | ||
ConstrainedBox( | ||
constraints: const BoxConstraints(maxHeight: 400), | ||
child: HtmlWidget( | ||
customStylesBuilder: auHtmlStyle, | ||
exhibition.noteBrief!, | ||
textStyle: theme.textTheme.ppMori400White14, | ||
onTapUrl: (url) async { | ||
await launchUrl(Uri.parse(url), | ||
mode: LaunchMode.externalApplication); | ||
return true; | ||
}, | ||
), | ||
), | ||
] | ||
if (exhibition.noteBrief != exhibition.note) ...[ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how about if both are null |
||
const SizedBox(height: 20), | ||
GestureDetector( | ||
onTap: () async { | ||
await injector<NavigationService>() | ||
.openFeralFileExhibitionNotePage(exhibition.slug); | ||
}, | ||
child: Text( | ||
'read_more'.tr(), | ||
style: theme.textTheme.ppMori400White14.copyWith( | ||
decoration: TextDecoration.underline, | ||
decorationColor: AppColor.white, | ||
), | ||
), | ||
), | ||
] | ||
], | ||
], | ||
), | ||
), | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
series index is definitely 0 in this case