The board also needs to accept new work. Keep title and context drafts in SprintTaskBoard; no other screen needs them before submission. Keep saved tasks and feedback in TaskBoardState, so the board and detail route see the same result.
The button's reduce block calls add_sprint_task, an ordinary Rust function that checks the title and context before changing shared state. Invalid input leaves the board and draft alone. A successful addition clears the draft and creates a Ready task with no due date. Without an identified teammate, the task stays unassigned; this tutorial does not invent a signed-in session merely to enable task creation.
The detail page calls advance_sprint_task through its own reduce block. These functions can be tested without rendering a screen, and neither needs a separate action type just to connect one button. A server-backed app would request the save through an effect and handle success and failure explicitly, rather than claim that an in-memory update has been persisted.
{"id":"fission-tabs-1","tabs":[{"index":0,"label":"src/app.rs","value":"src-app-rs"},{"index":1,"label":"src/state.rs","value":"src-state-rs"},{"index":2,"label":"src/pages/mod.rs","value":"src-pages-mod-rs"},{"index":3,"label":"src/pages/board.rs","value":"src-pages-board-rs"},{"index":4,"label":"src/pages/detail.rs","value":"src-pages-detail-rs"},{"index":5,"label":"src/pages/not_found.rs","value":"src-pages-not-found-rs"},{"index":6,"label":"src/widgets/mod.rs","value":"src-widgets-mod-rs"},{"index":7,"label":"src/widgets/task_card.rs","value":"src-widgets-task-card-rs"},{"index":8,"label":"src/widgets/task_lane.rs","value":"src-widgets-task-lane-rs"},{"index":9,"label":"preview/fixtures.rs","value":"preview-fixtures-rs"},{"index":10,"label":"preview/lib.rs","value":"preview-lib-rs"}]}
{"id":"fission-tabs-1","index":0,"label":"src/app.rs","value":"src-app-rs"}
use crate::pages::{SprintTaskBoard, SprintTaskDetail, TaskNotFound};
use crate::state::TaskBoardState;
use fission::prelude::*;
use std::sync::Arc;
fission_component! {
pub TaskBoardApp<TaskBoardState> {}
view(_app, state, _cx) {
let router = Router::<TaskBoardState>::new()
.with_path(state.current_path.clone())
.route("/", SprintTaskBoard::new)
.route("/projects/northstar", SprintTaskBoard::new)
.route("/tutorials/single-page-web-app-rust/:step", SprintTaskBoard::new)
.route_builder("/tasks/:id", Arc::new(|_, _, params| {
match params.get("id").and_then(|id| id.parse::<u32>().ok()) {
Some(task_id) => SprintTaskDetail::new(task_id).into(),
None => TaskNotFound::new().into(),
}
}))
.not_found(TaskNotFound::new);
} =>
Container(Scroll(child: Some(router.into())))
.height_length(Length::vh(100.0))
}
{"id":"fission-tabs-1","index":1,"label":"src/state.rs","value":"src-state-rs"}
use fission::prelude::*;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TaskStatus {
Ready,
InProgress,
InReview,
Done,
}
impl TaskStatus {
pub fn translation_key(self) -> &'static str {
match self {
Self::Ready => "sprint.status.ready",
Self::InProgress => "sprint.status.in_progress",
Self::InReview => "sprint.status.in_review",
Self::Done => "sprint.status.done",
}
}
pub fn next(self) -> Self {
match self {
Self::Ready => Self::InProgress,
Self::InProgress => Self::InReview,
Self::InReview => Self::Done,
Self::Done => Self::Done,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TaskPriority {
High,
Normal,
}
impl TaskPriority {
pub fn translation_key(self) -> &'static str {
match self {
Self::High => "sprint.priority.high",
Self::Normal => "sprint.priority.normal",
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum SprintFilter {
All,
Mine,
HighPriority,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SprintTask {
pub id: u32,
pub title: String,
pub team: String,
pub owner: String,
pub priority: TaskPriority,
pub due: String,
pub context: String,
pub status: TaskStatus,
}
pub(crate) fn task_matches(
task: &SprintTask,
query: &str,
filter: SprintFilter,
current_user: Option<&str>,
) -> bool {
let query = query.trim().to_lowercase();
let matches_query = query.is_empty()
|| task.title.to_lowercase().contains(&query)
|| task.owner.to_lowercase().contains(&query)
|| task.team.to_lowercase().contains(&query)
|| format!("NS-{}", task.id).to_lowercase().contains(&query);
let matches_filter = match filter {
SprintFilter::Mine => current_user.map(|name| task.owner == name).unwrap_or(false),
SprintFilter::HighPriority => task.priority == TaskPriority::High,
SprintFilter::All => true,
};
matches_query && matches_filter
}
#[derive(Clone, Debug, PartialEq)]
pub struct TaskBoardState {
pub current_path: String,
pub tasks: Vec<SprintTask>,
pub current_user: Option<String>,
pub feedback: Option<String>,
pub feedback_is_error: bool,
}
impl Default for TaskBoardState {
fn default() -> Self {
Self {
current_path: "/projects/northstar".into(),
tasks: Vec::new(),
current_user: None,
feedback: None,
feedback_is_error: false,
}
}
}
impl GlobalState for TaskBoardState {}
pub fn add_sprint_task(state: &mut TaskBoardState, title: String, context: String) {
let title = title.trim();
if title.chars().count() < 5 {
state.feedback = Some("sprint.feedback.title_too_short".into());
state.feedback_is_error = true;
return;
}
let context = context.trim();
if context.is_empty() {
state.feedback = Some("sprint.feedback.context_required".into());
state.feedback_is_error = true;
return;
}
let owner = state.current_user.clone().unwrap_or_default();
let Some(id) = state
.tasks
.iter()
.map(|task| task.id)
.max()
.unwrap_or_default()
.checked_add(1)
else {
state.feedback = Some("sprint.feedback.id_exhausted".into());
state.feedback_is_error = true;
return;
};
state.tasks.insert(
0,
SprintTask {
id,
title: title.to_string(),
team: "Product".to_string(),
owner,
priority: TaskPriority::Normal,
due: String::new(),
context: context.to_string(),
status: TaskStatus::Ready,
},
);
state.feedback = Some("sprint.feedback.task_added".into());
state.feedback_is_error = false;
}
pub fn advance_sprint_task(state: &mut TaskBoardState, task_id: u32) {
if let Some(task) = state.tasks.iter_mut().find(|task| task.id == task_id) {
if task.status == TaskStatus::Done {
state.feedback = Some("sprint.feedback.already_done".into());
state.feedback_is_error = true;
return;
}
task.status = task.status.next();
state.feedback = Some("sprint.feedback.task_moved".into());
state.feedback_is_error = false;
} else {
state.feedback = Some("sprint.feedback.task_missing".into());
state.feedback_is_error = true;
}
}
pub fn route_changed(
state: &mut TaskBoardState,
action: fission::core::action::ShellRouteChanged,
_cx: &mut ReducerContext<TaskBoardState>,
) {
state.current_path = action.location.pathname;
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn a_new_task_can_be_created_without_inventing_a_signed_in_user() {
let mut state = TaskBoardState::default();
add_sprint_task(&mut state, "Check VAT rounding".into(), "Compare inclusive and exclusive prices".into());
assert_eq!(state.tasks.len(), 1);
assert!(state.tasks[0].owner.is_empty());
assert_eq!(state.tasks[0].status, TaskStatus::Ready);
assert!(!state.feedback_is_error);
}
#[test]
fn invalid_context_does_not_create_a_task() {
let mut state = TaskBoardState::default();
add_sprint_task(&mut state, "Check VAT rounding".into(), " ".into());
assert!(state.tasks.is_empty());
assert!(state.feedback_is_error);
}
#[test]
fn advancing_a_missing_task_reports_failure() {
let mut state = TaskBoardState::default();
advance_sprint_task(&mut state, 241);
assert!(state.tasks.is_empty());
assert!(state.feedback_is_error);
}
}
{"id":"fission-tabs-1","index":2,"label":"src/pages/mod.rs","value":"src-pages-mod-rs"}
mod board;
mod detail;
mod not_found;
pub use board::SprintTaskBoard;
pub use detail::SprintTaskDetail;
pub use not_found::TaskNotFound;
{"id":"fission-tabs-1","index":3,"label":"src/pages/board.rs","value":"src-pages-board-rs"}
use crate::state::{add_sprint_task, task_matches, SprintFilter, SprintTask, TaskBoardState, TaskPriority, TaskStatus};
use crate::widgets::{SprintTaskCard, SprintTaskLane};
use fission::prelude::*;
fission_component! {
pub SprintTaskBoard<TaskBoardState> {
state {
search: String = String::new(),
filter: SprintFilter = SprintFilter::All,
show_composer: bool = false,
draft_title: String = String::new(),
draft_context: String = String::new(),
}
}
view(board, state, cx) {
let tokens = &cx.view.env().theme.tokens;
let query = board.search.clone();
let filter = board.filter;
let current_user = state.current_user.as_deref();
let matches = |task: &&SprintTask| task_matches(task, &query, filter, current_user);
let ready = state.tasks.iter().filter(|task| matches(task) && task.status == TaskStatus::Ready).cloned().collect::<Vec<_>>();
let in_progress = state.tasks.iter().filter(|task| matches(task) && task.status == TaskStatus::InProgress).cloned().collect::<Vec<_>>();
let in_review = state.tasks.iter().filter(|task| matches(task) && task.status == TaskStatus::InReview).cloned().collect::<Vec<_>>();
let done_tasks = state.tasks.iter().filter(|task| matches(task) && task.status == TaskStatus::Done).cloned().collect::<Vec<_>>();
let open_count = state.tasks.iter().filter(|task| task.status != TaskStatus::Done).count();
let review_count = state.tasks.iter().filter(|task| task.status == TaskStatus::InReview).count();
let high_priority_count = state.tasks.iter().filter(|task| task.priority == TaskPriority::High).count();
let completed_count = state.tasks.iter().filter(|task| task.status == TaskStatus::Done).count();
let completed_percent = if state.tasks.is_empty() { 0 } else { completed_count * 100 / state.tasks.len() };
} =>
Container(
Column(gap: tokens.spacing.l, children: [
Row(gap: tokens.spacing.m, children: [
Text("H").weight(tokens.typography.font_weight_bold),
Column(gap: tokens.spacing.xs, children: [
Text(cx.tr("sprint.workspace.name")).weight(tokens.typography.font_weight_bold),
Text(cx.tr("sprint.workspace.kind")).color(tokens.colors.text_secondary),
]),
Spacer(flex_grow: 1.0),
Text(cx.tr("sprint.team.label")),
]),
Column(gap: tokens.spacing.s, children: [
Text(cx.tr("sprint.board.breadcrumb")).color(tokens.colors.text_secondary),
Container(Row(gap: tokens.spacing.m, align_items: ir_op::AlignItems::Center,
justify_content: ir_op::JustifyContent::SpaceBetween,
wrap: ir_op::FlexWrap::Wrap, children: [
Column(gap: tokens.spacing.xs, children: [
Text(cx.tr("sprint.board.title")).weight(tokens.typography.font_weight_bold),
Text(cx.tr("sprint.board.subtitle")).color(tokens.colors.text_secondary),
]),
Button(
child: Text(cx.tr(if board.show_composer { "sprint.action.close_form" } else { "sprint.action.new_task" })),
key: "open-task-form",
on_press: reduce { board.show_composer = !board.show_composer; },
).semantics_identifier("sprint.open-task-form".to_string()),
])).width_length(Length::percent(100.0)),
]),
Grid(
columns: vec![GridTrack::auto_fit(GridTrack::minmax(GridTrack::Points(210.0), GridTrack::Fr(1.0)))],
rows: vec![GridTrack::Auto],
column_gap: tokens.spacing.m,
row_gap: tokens.spacing.m,
children: [
Container(Column(children: [
Text(cx.tr("sprint.metric.open")).color(tokens.colors.text_secondary),
Text(open_count.to_string()).weight(tokens.typography.font_weight_bold),
Text(cx.tr("sprint.metric.open.context")).color(tokens.colors.text_secondary),
])).padding_all(tokens.spacing.m).bg(tokens.colors.surface).border(tokens.colors.border, 1.0).border_radius(tokens.radii.medium),
Container(Column(children: [
Text(cx.tr("sprint.metric.review")).color(tokens.colors.text_secondary),
Text(review_count.to_string()).weight(tokens.typography.font_weight_bold),
Text(cx.tr("sprint.metric.review.context")).color(tokens.colors.text_secondary),
])).padding_all(tokens.spacing.m).bg(tokens.colors.surface).border(tokens.colors.border, 1.0).border_radius(tokens.radii.medium),
Container(Column(children: [
Text(cx.tr("sprint.metric.high_priority")).color(tokens.colors.text_secondary),
Text(high_priority_count.to_string()).weight(tokens.typography.font_weight_bold),
Text(cx.tr("sprint.metric.high_priority.context")).color(tokens.colors.text_secondary),
])).padding_all(tokens.spacing.m).bg(tokens.colors.surface).border(tokens.colors.border, 1.0).border_radius(tokens.radii.medium),
Container(Column(children: [
Row(gap: tokens.spacing.s, children: [
Text(cx.tr("sprint.metric.progress")).weight(tokens.typography.font_weight_semibold),
Spacer(flex_grow: 1.0),
Text(format!("{}% {}", completed_percent, cx.tr("sprint.metric.complete"))),
]),
ProgressBar(value: completed_percent as f32 / 100.0),
Text(format!("{} / {} {}", completed_count, state.tasks.len(), cx.tr("sprint.metric.tasks_complete")))
.color(tokens.colors.text_secondary),
])).padding_all(tokens.spacing.m).bg(tokens.colors.surface).border(tokens.colors.border, 1.0).border_radius(tokens.radii.medium),
],
),
Container(Row(gap: tokens.spacing.m, align_items: ir_op::AlignItems::Center,
justify_content: ir_op::JustifyContent::SpaceBetween,
wrap: ir_op::FlexWrap::Wrap, children: [
Row(gap: tokens.spacing.s, wrap: ir_op::FlexWrap::Wrap, children: [
Button(child: Text(format!("{} · {}", cx.tr("sprint.filter.all"), state.tasks.len())), key: "filter-all",
variant: if board.filter == SprintFilter::All { ButtonVariant::Primary } else { ButtonVariant::Outline },
on_press: reduce { board.filter = SprintFilter::All; })
.semantics_identifier("sprint.filter-all".to_string()),
Button(child: Text(cx.tr("sprint.filter.mine")), key: "filter-mine",
disabled: state.current_user.is_none(),
variant: if board.filter == SprintFilter::Mine { ButtonVariant::Primary } else { ButtonVariant::Outline },
on_press: reduce { board.filter = SprintFilter::Mine; })
.semantics_identifier("sprint.filter-mine".to_string()),
Button(child: Text(cx.tr("sprint.filter.high_priority")), key: "filter-high",
variant: if board.filter == SprintFilter::HighPriority { ButtonVariant::Primary } else { ButtonVariant::Outline },
on_press: reduce { board.filter = SprintFilter::HighPriority; })
.semantics_identifier("sprint.filter-high".to_string()),
]),
Container(TextInput(label: Some(cx.tr("sprint.search.label").into()),
placeholder: Some(cx.tr("sprint.search.hint").into()), bind: board.search,
semantics_identifier: "sprint.search".to_string()))
.width_length(Length::Points(280.0)),
])).width_length(Length::percent(100.0)),
if board.show_composer {
Container(Column(gap: tokens.spacing.s, children: [
Text(cx.tr("sprint.form.title")).weight(tokens.typography.font_weight_bold),
Text(cx.tr("sprint.form.description"))
.color(tokens.colors.text_secondary),
TextInput(label: Some(cx.tr("sprint.form.task_title").into()), placeholder: Some(cx.tr("sprint.form.task_title_hint").into()),
bind: board.draft_title, semantics_identifier: "sprint.new-task.title".to_string()),
TextInput(label: Some(cx.tr("sprint.form.context").into()), placeholder: Some(cx.tr("sprint.form.context_hint").into()),
multiline: true, bind: board.draft_context, semantics_identifier: "sprint.new-task.context".to_string()),
if state.current_user.is_none() {
Text(cx.tr("sprint.form.unassigned_hint"))
.color(tokens.colors.text_secondary)
},
Row(gap: tokens.spacing.s, children: [
Button(child: Text(cx.tr("sprint.action.add_task")), key: "add-sprint-task",
on_press: reduce {
add_sprint_task(state, board.draft_title.clone(), board.draft_context.clone());
if !state.feedback_is_error {
board.draft_title = String::new();
board.draft_context = String::new();
board.show_composer = false;
}
})
.semantics_identifier("sprint.add-task".to_string()),
Button(child: Text(cx.tr("sprint.action.cancel")), key: "cancel-sprint-task", variant: ButtonVariant::Outline,
on_press: reduce { board.show_composer = false; })
.semantics_identifier("sprint.cancel-task".to_string()),
]),
])).padding_all(tokens.spacing.m).bg(tokens.colors.surface).border(tokens.colors.border, 1.0).border_radius(tokens.radii.medium)
},
if let Some(message) = state.feedback.clone() {
SemanticsRegion(
identifier: Some(if state.feedback_is_error { "sprint-feedback-error".into() } else { "sprint-feedback-success".into() }),
label: Some(cx.tr(message.as_str())),
child: Text(cx.tr(message.as_str())).color(tokens.colors.text_secondary),
)
},
Grid(
columns: vec![GridTrack::auto_fit(GridTrack::minmax(GridTrack::Points(260.0), GridTrack::Fr(1.0)))],
rows: vec![GridTrack::Auto],
column_gap: tokens.spacing.m,
row_gap: tokens.spacing.m,
children: [
SprintTaskLane(cx.tr("sprint.status.ready"), TaskStatus::Ready, ready),
SprintTaskLane(cx.tr("sprint.status.in_progress"), TaskStatus::InProgress, in_progress),
SprintTaskLane(cx.tr("sprint.status.in_review"), TaskStatus::InReview, in_review),
],
),
Column(gap: tokens.spacing.s, children: [
Row(gap: tokens.spacing.m, align_items: ir_op::AlignItems::Center, children: [
Text(cx.tr("sprint.completed.title")).weight(tokens.typography.font_weight_bold),
Spacer(flex_grow: 1.0),
Text(format!("{} {}", done_tasks.len(), cx.tr("sprint.completed.count"))).color(tokens.colors.text_secondary),
]),
if done_tasks.is_empty() {
Text(cx.tr("sprint.completed.empty"))
.color(tokens.colors.text_secondary)
} else {
Grid(
columns: vec![GridTrack::auto_fit(GridTrack::minmax(GridTrack::Points(260.0), GridTrack::Fr(1.0)))],
rows: vec![GridTrack::Auto],
column_gap: tokens.spacing.m,
row_gap: tokens.spacing.m,
children: [
for task in done_tasks.iter() {
SprintTaskCard(task.clone(), key: task.id)
},
],
)
},
]),
]),
)
.padding_all(tokens.spacing.l)
.bg(tokens.colors.background)
}
{"id":"fission-tabs-1","index":4,"label":"src/pages/detail.rs","value":"src-pages-detail-rs"}
use crate::state::{advance_sprint_task, TaskBoardState, TaskStatus};
use fission::prelude::*;
fission_component! {
pub SprintTaskDetail<TaskBoardState> { props { task_id: u32 } }
view(page, state, cx) {
let tokens = &cx.view.env().theme.tokens;
let task = state.tasks.iter().find(|task| task.id == page.task_id).cloned();
} =>
if let Some(task) = task {
Center(Container(Column(gap: tokens.spacing.m, children: [
Link::to(cx.tr("sprint.link.board"), "/projects/northstar"),
Text(format!("NS-{} · {}", task.id, cx.tr(task.status.translation_key()))).color(tokens.colors.text_secondary),
Text(task.title.clone()).weight(tokens.typography.font_weight_bold),
Text(format!(
"{} · {} · {}",
task.team,
cx.tr(task.priority.translation_key()),
if task.due.is_empty() { cx.tr("sprint.due.unscheduled") } else { task.due.clone() },
))
.color(tokens.colors.text_secondary),
Text(cx.tr("sprint.task.context_label")).weight(tokens.typography.font_weight_semibold),
Text(task.context.clone()),
Text(format!("{}: {}", cx.tr("sprint.task.owner"), if task.owner.is_empty() { cx.tr("sprint.owner.unassigned") } else { task.owner })),
if task.status != TaskStatus::Done {
Button(
child: Text(format!("{} {}", cx.tr("sprint.action.move_to"), cx.tr(task.status.next().translation_key()))),
key: "advance-sprint-task",
on_press: reduce { advance_sprint_task(state, page.task_id); },
).semantics_identifier("sprint.advance-task".to_string())
} else {
Text(cx.tr("sprint.task.completed"))
},
])).width_length(Length::percent(100.0)).max_width(760.0).padding_all(tokens.spacing.l).bg(tokens.colors.surface).border(tokens.colors.border, 1.0).border_radius(tokens.radii.medium))
} else {
Center(Container(Column(gap: tokens.spacing.m, children: [
Text(cx.tr("sprint.task.missing")).weight(tokens.typography.font_weight_semibold),
Link::to(cx.tr("sprint.link.return_board"), "/projects/northstar"),
])).width_length(Length::percent(100.0)).max_width(760.0).padding_all(tokens.spacing.l).bg(tokens.colors.surface).border(tokens.colors.border, 1.0).border_radius(tokens.radii.medium))
}
}
{"id":"fission-tabs-1","index":5,"label":"src/pages/not_found.rs","value":"src-pages-not-found-rs"}
use crate::state::TaskBoardState;
use fission::prelude::*;
fission_component! {
pub TaskNotFound<TaskBoardState> {}
view(_page, _state, cx) {
let tokens = &cx.view.env().theme.tokens;
} =>
Container(
Column(gap: tokens.spacing.m, children: [
Text(cx.tr("sprint.page.missing")).weight(tokens.typography.font_weight_bold),
Link::to(cx.tr("sprint.link.return_board"), "/projects/northstar"),
]),
)
.padding_all(tokens.spacing.l)
}
{"id":"fission-tabs-1","index":6,"label":"src/widgets/mod.rs","value":"src-widgets-mod-rs"}
mod task_card;
mod task_lane;
pub use task_card::SprintTaskCard;
pub use task_lane::SprintTaskLane;
{"id":"fission-tabs-1","index":7,"label":"src/widgets/task_card.rs","value":"src-widgets-task-card-rs"}
use crate::state::{SprintTask, TaskBoardState, TaskPriority, TaskStatus};
use fission::prelude::*;
fission_component! {
pub SprintTaskCard<TaskBoardState> { props { task: SprintTask } }
view(card, _state, cx) {
let tokens = &cx.view.env().theme.tokens;
let task_path = format!("/tasks/{}", card.task.id);
let due_label = if card.task.due.is_empty() {
cx.tr("sprint.due.unscheduled")
} else {
card.task.due.clone()
};
let priority_tone = match card.task.priority {
TaskPriority::High => BadgeTone::Error,
TaskPriority::Normal => BadgeTone::Gray,
};
let owner_label = if card.task.owner.is_empty() {
cx.tr("sprint.owner.unassigned")
} else {
card.task.owner.clone()
};
let status_tone = match card.task.status {
TaskStatus::Ready => BadgeTone::Blue,
TaskStatus::InProgress => BadgeTone::Brand,
TaskStatus::InReview => BadgeTone::Warning,
TaskStatus::Done => BadgeTone::Success,
};
} =>
Container(
Column(gap: tokens.spacing.s, children: [
Link::to(card.task.title.clone(), task_path),
Text(format!("Northstar · {} · NS-{}", card.task.team, card.task.id))
.color(tokens.colors.text_secondary),
Row(gap: tokens.spacing.xs, wrap: ir_op::FlexWrap::Wrap, children: [
Badge(
text: cx.tr(card.task.priority.translation_key()),
tone: priority_tone,
size: ComponentSize::Sm,
),
Badge(
text: cx.tr(card.task.status.translation_key()),
tone: status_tone,
size: ComponentSize::Sm,
),
]),
Row(gap: tokens.spacing.s, align_items: ir_op::AlignItems::Center, children: [
Avatar(
name: if card.task.owner.is_empty() { None } else { Some(card.task.owner.clone()) },
size: Some(tokens.spacing.l),
),
Text(owner_label).weight(tokens.typography.font_weight_semibold),
Spacer(flex_grow: 1.0),
Text(due_label).color(tokens.colors.text_secondary),
]),
]),
)
.padding_all(tokens.spacing.m)
.bg(tokens.colors.surface)
.border(tokens.colors.border, 1.0)
.border_radius(tokens.radii.medium)
}
{"id":"fission-tabs-1","index":8,"label":"src/widgets/task_lane.rs","value":"src-widgets-task-lane-rs"}
use super::SprintTaskCard;
use crate::state::{SprintTask, TaskBoardState, TaskStatus};
use fission::prelude::*;
fission_component! {
pub SprintTaskLane<TaskBoardState> {
props {
title: String,
status: TaskStatus,
tasks: Vec<SprintTask>,
}
}
view(lane, _state, cx) {
let tokens = &cx.view.env().theme.tokens;
} =>
SemanticsRegion(
identifier: Some(format!("sprint-lane-{:?}", lane.status)),
label: Some(lane.title.clone()),
child: Container(
Column(gap: tokens.spacing.s, children: [
Row(gap: tokens.spacing.s, children: [
Text(lane.title.clone()).weight(tokens.typography.font_weight_bold),
Spacer(flex_grow: 1.0),
Text(lane.tasks.len().to_string()).color(tokens.colors.text_secondary),
]),
if lane.tasks.is_empty() {
Text(cx.tr("sprint.empty.filter")).color(tokens.colors.text_secondary)
} else {
Column(gap: tokens.spacing.s, children: [
for task in lane.tasks.iter() {
SprintTaskCard(task.clone(), key: task.id)
},
])
},
]),
)
.padding_all(tokens.spacing.s)
.bg(tokens.colors.background)
.border(tokens.colors.border, 1.0)
.border_radius(tokens.radii.medium),
)
}
{"id":"fission-tabs-1","index":9,"label":"preview/fixtures.rs","value":"preview-fixtures-rs"}
use crate::state::{SprintTask, TaskPriority, TaskStatus};
fn task(
id: u32,
title: &str,
team: &str,
owner: &str,
priority: TaskPriority,
due: &str,
context: &str,
status: TaskStatus,
) -> SprintTask {
SprintTask {
id,
title: title.into(),
team: team.into(),
owner: owner.into(),
priority,
due: due.into(),
context: context.into(),
status,
}
}
pub fn sample_tasks() -> Vec<SprintTask> {
vec![
task(241, "Finalize checkout empty state", "Design", "Leo Ortiz", TaskPriority::High, "Due today", "Explain what is missing on a first checkout and give the customer one clear next step.", TaskStatus::Ready),
task(244, "Confirm tax calculation for EU orders", "Payments", "Mara Chen", TaskPriority::High, "Due tomorrow", "Verify rounding for VAT-inclusive and VAT-exclusive prices before the launch review.", TaskStatus::Ready),
task(250, "Write the failed payment recovery email", "Content", "Erin Park", TaskPriority::Normal, "Due Thu", "Explain when the retry happens and give the customer a direct way to update payment details.", TaskStatus::Ready),
task(236, "Instrument payment retry events", "Backend", "Sam Patel", TaskPriority::High, "Due today", "Record the retry number and result without sending payment details to analytics.", TaskStatus::InProgress),
task(238, "Connect the order confirmation screen", "Frontend", "Mara Chen", TaskPriority::Normal, "Due Wed", "Render the confirmation from the order returned by checkout so the receipt matches the saved order.", TaskStatus::InProgress),
task(239, "Check keyboard flow in the address form", "Accessibility", "Leo Ortiz", TaskPriority::Normal, "Due Thu", "Check focus order and make sure the field error is announced when the address is incomplete.", TaskStatus::InProgress),
task(232, "Review order confirmation copy", "Content", "Erin Park", TaskPriority::Normal, "Due today", "Check the order number, delivery window and support route against the launch checklist.", TaskStatus::InReview),
task(233, "Approve mobile checkout layout", "Design", "Sam Patel", TaskPriority::High, "Due Fri", "Review long addresses and the on-screen keyboard at a phone width.", TaskStatus::InReview),
task(221, "Agree the launch success measures", "Planning", "Mara Chen", TaskPriority::Normal, "Completed Mon", "Track completed checkouts, payment retries and support contacts after release.", TaskStatus::Done),
task(224, "Confirm the launch support rota", "Operations", "Erin Park", TaskPriority::Normal, "Completed Tue", "Publish support coverage for launch day and document the handoff.", TaskStatus::Done),
task(228, "Approve the checkout event schema", "Analytics", "Sam Patel", TaskPriority::High, "Completed Tue", "Include the order id and result while keeping payment details out of analytics.", TaskStatus::Done),
]
}
{"id":"fission-tabs-1","index":10,"label":"preview/lib.rs","value":"preview-lib-rs"}
mod app;
mod pages;
mod state;
mod widgets;
#[path = "../preview/fixtures.rs"]
mod fixtures;
mod translations;
use fission::prelude::*;
use wasm_bindgen::prelude::*;
#[wasm_bindgen(start)]
pub fn run() -> Result<(), JsValue> {
console_error_panic_hook::set_once();
WebApp::<state::TaskBoardState, _>::new(app::TaskBoardApp::new())
.with_state_init(|state| {
state.current_user = Some("Mara Chen".into());
state.tasks = fixtures::sample_tasks();
})
.with_env(translations::create_env())
.with_route_handler(state::route_changed)
.with_title("Northstar sprint board")
.mount("#fission-web-mount")
.run()
.map_err(|error| JsValue::from_str(&error.to_string()))
}
{"id":"fission-tabs-1"}
Run, test and build the finished project
From the project root, run the checks in order:
fission doctor --project-dir .
cargo fmt --all -- --check
cargo test
fission run --target web --project-dir .
fission build --target web --project-dir .
fission test --target web --project-dir .
Northstar should now have a useful empty state, three task routes, validated task creation, status transitions, and browser history that returns to the right screen.
Use these precise reference pages after the working path above is clear: