@@ -60,7 +60,8 @@ type SubmissionRow = SubmissionInfo & {
6060 aggregated ?: AggregatedSubmissionReviews
6161}
6262
63- const DOWNLOAD_OWN_SUBMISSION_TOOLTIP = 'You can only download your own submissions.'
63+ const DOWNLOAD_OWN_SUBMISSION_TOOLTIP
64+ = 'You can download only your own submissions until the challenge completes or fails review.'
6465const VIEW_OWN_SCORECARD_TOOLTIP = 'You can only view scorecards for your own submissions.'
6566
6667export const TableReviewAppealsForSubmitter : FC < Props > = ( props : Props ) => {
@@ -77,6 +78,7 @@ export const TableReviewAppealsForSubmitter: FC<Props> = (props: Props) => {
7778 isSubmissionDownloadRestricted,
7879 isSubmissionDownloadRestrictedForMember,
7980 restrictionMessage,
81+ shouldRestrictSubmitterToOwnSubmission,
8082 } : UseSubmissionDownloadAccessResult = useSubmissionDownloadAccess ( )
8183 const challengeType = challengeInfo ?. type
8284 const challengeTrack = challengeInfo ?. track
@@ -361,20 +363,26 @@ export const TableReviewAppealsForSubmitter: FC<Props> = (props: Props) => {
361363 const isOwnedSubmission = data . memberId
362364 ? ownedMemberIds . has ( data . memberId )
363365 : false
364- const isOwnershipRestricted = ! isOwnedSubmission
366+ const isOwnershipRestricted = shouldRestrictSubmitterToOwnSubmission
367+ && ! isOwnedSubmission
368+ const isRestrictedForMember = isSubmissionDownloadRestrictedForMember (
369+ data . memberId ,
370+ )
371+ const memberRestrictionMessage = getRestrictionMessageForMember (
372+ data . memberId ,
373+ )
365374 const failedScan = data . virusScan === false
366375 const isButtonDisabled = Boolean (
367376 isDownloading [ data . id ]
368- || isSubmissionDownloadRestricted
369- || failedScan
370- || isOwnershipRestricted ,
377+ || isRestrictedForMember
378+ || failedScan ,
371379 )
372380
373381 const downloadButton = (
374382 < button
375383 onClick = { function onClick ( ) {
376384 if (
377- isSubmissionDownloadRestricted
385+ isRestrictedForMember
378386 || failedScan
379387 || isOwnershipRestricted
380388 ) {
@@ -410,6 +418,10 @@ export const TableReviewAppealsForSubmitter: FC<Props> = (props: Props) => {
410418 let tooltipContent : string | undefined
411419 if ( failedScan ) {
412420 tooltipContent = 'Submission failed virus scan'
421+ } else if ( isRestrictedForMember ) {
422+ tooltipContent = memberRestrictionMessage
423+ ?? restrictionMessage
424+ ?? DOWNLOAD_OWN_SUBMISSION_TOOLTIP
413425 } else if ( isOwnershipRestricted ) {
414426 tooltipContent = DOWNLOAD_OWN_SUBMISSION_TOOLTIP
415427 } else if ( isSubmissionDownloadRestricted && restrictionMessage ) {
@@ -532,30 +544,33 @@ export const TableReviewAppealsForSubmitter: FC<Props> = (props: Props) => {
532544 const reviewDetail = data . aggregated ?. reviews ?. [ 0 ]
533545 const reviewId = reviewDetail ?. reviewInfo ?. id || reviewDetail ?. reviewId
534546 if ( reviewId ) {
535- const scoreElement = isOwnedSubmission ? (
536- < Link
537- to = { `./../review/${ reviewId } ` }
538- className = { styles . textBlue }
539- >
540- { scoreDisplay }
541- </ Link >
542- ) : (
547+ const canViewScorecard = isChallengeCompleted || isOwnedSubmission
548+ const scoreContent = (
543549 < span className = { styles . textBlue } >
544550 { scoreDisplay }
545551 </ span >
546552 )
547553
548- return ! isOwnedSubmission ? (
549- < Tooltip
550- content = { VIEW_OWN_SCORECARD_TOOLTIP }
551- triggerOn = 'click-hover'
554+ if ( ! canViewScorecard ) {
555+ return (
556+ < Tooltip
557+ content = { VIEW_OWN_SCORECARD_TOOLTIP }
558+ triggerOn = 'click-hover'
559+ >
560+ < span className = { styles . tooltipTrigger } >
561+ { scoreContent }
562+ </ span >
563+ </ Tooltip >
564+ )
565+ }
566+
567+ return (
568+ < Link
569+ to = { `./../review/${ reviewId } ` }
570+ className = { styles . textBlue }
552571 >
553- < span className = { styles . tooltipTrigger } >
554- { scoreElement }
555- </ span >
556- </ Tooltip >
557- ) : (
558- scoreElement
572+ { scoreDisplay }
573+ </ Link >
559574 )
560575 }
561576 }
@@ -635,6 +650,29 @@ export const TableReviewAppealsForSubmitter: FC<Props> = (props: Props) => {
635650 const formattedScore = typeof finalScore === 'number' && Number . isFinite ( finalScore )
636651 ? finalScore . toFixed ( 2 )
637652 : undefined
653+ const isOwnedSubmission = data . memberId
654+ ? ownedMemberIds . has ( data . memberId )
655+ : false
656+ const canViewScorecard = isChallengeCompleted || isOwnedSubmission
657+ const scoreContent = (
658+ < span className = { styles . textBlue } >
659+ { formattedScore ?? '--' }
660+ </ span >
661+ )
662+
663+ if ( ! canViewScorecard ) {
664+ return (
665+ < Tooltip
666+ content = { VIEW_OWN_SCORECARD_TOOLTIP }
667+ triggerOn = 'click-hover'
668+ >
669+ < span className = { styles . tooltipTrigger } >
670+ { scoreContent }
671+ </ span >
672+ </ Tooltip >
673+ )
674+ }
675+
638676 return (
639677 < Link
640678 to = { `./../review/${ reviewId } ` }
@@ -673,6 +711,35 @@ export const TableReviewAppealsForSubmitter: FC<Props> = (props: Props) => {
673711 )
674712 }
675713
714+ const isOwnedSubmission = data . memberId
715+ ? ownedMemberIds . has ( data . memberId )
716+ : false
717+ const canViewScorecard = isChallengeCompleted || isOwnedSubmission
718+ const appealsContent = (
719+ < span className = { styles . textBlue } >
720+ { totalAppeals }
721+ </ span >
722+ )
723+
724+ if ( ! canViewScorecard ) {
725+ return (
726+ < Tooltip
727+ content = { VIEW_OWN_SCORECARD_TOOLTIP }
728+ triggerOn = 'click-hover'
729+ >
730+ < span
731+ className = { classNames (
732+ styles . tooltipTrigger ,
733+ styles . appealsLink ,
734+ 'last-element' ,
735+ ) }
736+ >
737+ { appealsContent }
738+ </ span >
739+ </ Tooltip >
740+ )
741+ }
742+
676743 return (
677744 < Link
678745 className = { classNames (
@@ -681,7 +748,7 @@ export const TableReviewAppealsForSubmitter: FC<Props> = (props: Props) => {
681748 ) }
682749 to = { `./../review/${ reviewId } ` }
683750 >
684- < span className = { styles . textBlue } > { totalAppeals } </ span >
751+ { appealsContent }
685752 </ Link >
686753 )
687754 }
@@ -794,8 +861,10 @@ export const TableReviewAppealsForSubmitter: FC<Props> = (props: Props) => {
794861 canDisplayScores ,
795862 shouldShowHistoryActions ,
796863 downloadSubmission ,
864+ getRestrictionMessageForMember ,
797865 historyByMember ,
798866 isSubmissionDownloadRestricted ,
867+ isSubmissionDownloadRestrictedForMember ,
799868 isDownloading ,
800869 isChallengeCompleted ,
801870 maxReviewCount ,
@@ -808,6 +877,7 @@ export const TableReviewAppealsForSubmitter: FC<Props> = (props: Props) => {
808877 isSubmissionTab ,
809878 isAppealsTab ,
810879 ownedMemberIds ,
880+ shouldRestrictSubmitterToOwnSubmission ,
811881 ] )
812882
813883 const columnsMobile = useMemo < MobileTableColumn < SubmissionRow > [ ] [ ] > (
0 commit comments