57f5219628
Each recorded artifact now carries a server group (deliverable or debug). public/ files are deliverables; input/memory/history/output.md, session exports and private/ scratch are debugging files. The app's Artifacts tab lists deliverables and the Debug toggle reveals a separate Debugging files group (older servers fall back to the filename rule); the TUI lists deliverables first and marks debug rows; artifact search excludes debug files unless include_debug / --debug-files is set.
141 lines
4.5 KiB
Dart
141 lines
4.5 KiB
Dart
import '../../../ui/layout/section_heading.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
import '../../../ui/adaptive/host.dart';
|
|
import '../domain/artifact_document.dart';
|
|
import '../domain/artifact_groups.dart';
|
|
import 'artifact_record_row.dart';
|
|
import 'artifact_row_labels.dart';
|
|
|
|
/// The gallery's label for a visit's runner-internal files (turn documents,
|
|
/// history.md, private/ scratch, session exports), shown only while Debug is on.
|
|
const String debuggingFilesTitle = 'Debugging files';
|
|
|
|
/// One visit's turn documents, shown below its stage artifacts.
|
|
///
|
|
/// A recorded document is a normal gallery row with its recorded name, MIME and
|
|
/// size. A document the visit did not record is a non-actionable row carrying
|
|
/// the exact absence wording. The section never synthesizes a missing document
|
|
/// from another field and never offers an action for it.
|
|
class ArtifactDocumentSection extends StatelessWidget {
|
|
const ArtifactDocumentSection({
|
|
super.key,
|
|
required this.group,
|
|
this.selectedIdentity,
|
|
this.onSelected,
|
|
this.showHeader = true,
|
|
this.title = 'Turn documents',
|
|
});
|
|
|
|
/// The section label: the Session page names the turn documents; the gallery
|
|
/// names every runner-internal file it lists as debugging files.
|
|
final String title;
|
|
|
|
/// False when a collapsible title above already names the section.
|
|
final bool showHeader;
|
|
|
|
final ArtifactGroup group;
|
|
final String? selectedIdentity;
|
|
final ArtifactSelected? onSelected;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final rows = <Widget>[
|
|
for (final document in group.documents) _row(document),
|
|
];
|
|
if (!showHeader) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: rows,
|
|
);
|
|
}
|
|
// Flat rows under a quiet label on both hosts: the section sits inside
|
|
// the visit's Session page, which is itself flat, so a Cupertino inset
|
|
// group here would be a group nested in a group.
|
|
final cupertino = usesCupertinoHost(context);
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(16, 12, 16, 4),
|
|
child: Semantics(
|
|
container: true,
|
|
header: true,
|
|
child: Text(
|
|
title,
|
|
style: cupertino ? SectionHeadingStyle.of(context).title : null,
|
|
),
|
|
),
|
|
),
|
|
...rows,
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget _row(ArtifactDocument document) {
|
|
final record = document.record;
|
|
if (record == null) return _AbsentDocumentRow(document: document);
|
|
final key = ValueKey<String>(
|
|
'${artifactVisitIdentity(group, record)}\u0000document',
|
|
);
|
|
return ArtifactRecordRow(
|
|
key: key,
|
|
group: group,
|
|
artifact: record,
|
|
selected: selectedIdentity == artifactVisitIdentity(group, record),
|
|
onSelected: onSelected,
|
|
);
|
|
}
|
|
}
|
|
|
|
/// A document the visit did not record: the recorded name and its exact absence
|
|
/// wording, with no tap target.
|
|
class _AbsentDocumentRow extends StatelessWidget {
|
|
const _AbsentDocumentRow({required this.document});
|
|
|
|
final ArtifactDocument document;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
if (!usesCupertinoHost(context)) {
|
|
// The absence line is informational product content, so it keeps the
|
|
// theme's normal secondary label colour. A disabled tile would paint both
|
|
// lines at the disabled colour (about 2.7:1 in light mode); no `onTap`
|
|
// keeps the row non-actionable without dimming it.
|
|
return ListTile(
|
|
title: Text(document.name),
|
|
subtitle: Text(
|
|
document.absence,
|
|
style: TextStyle(
|
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
final textTheme = CupertinoTheme.of(context).textTheme;
|
|
final absenceStyle = textTheme.textStyle.copyWith(
|
|
color: CupertinoColors.secondaryLabel.resolveFrom(context),
|
|
);
|
|
return Semantics(
|
|
container: true,
|
|
child: SizedBox(
|
|
width: double.infinity,
|
|
child: Padding(
|
|
padding: kCupertinoButtonPadding[CupertinoButtonSize.large]!,
|
|
child: DefaultTextStyle.merge(
|
|
style: textTheme.textStyle,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(document.name),
|
|
Text(document.absence, style: absenceStyle),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|