Skip to content

Commit

Permalink
Removed dead code: crime script card
Browse files Browse the repository at this point in the history
  • Loading branch information
driver-deploy-2 committed Sep 17, 2024
1 parent 07ddd6d commit 238124c
Showing 1 changed file with 0 additions and 71 deletions.
71 changes: 0 additions & 71 deletions packages/gui/src/components/home-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,79 +55,8 @@ export const HomePage: MeiosisComponent = () => {
]);
}),
])
// crimeScripts.map((crimeScript) =>
// m(CrimeScriptCard, { crimeScript, cast, acts, changePage: actions.changePage })
// )
),
]);
},
};
};

export const CrimeScriptCard: FactoryComponent<{
crimeScript: CrimeScript;
cast: Cast[];
acts: Act[];
changePage: (
page: Pages,
params?: Record<string, string | number | undefined>,
query?: Record<string, string | number | undefined>
) => void;
}> = () => {
return {
view: ({ attrs: { crimeScript, cast = [], acts: allActs = [], changePage } }) => {
const { id, url = scriptIcon, label: name = t('NEW_ACT'), stages: actVariants = [], description } = crimeScript;

const acts = actVariants.map((variant) => allActs.find((a) => a.id === variant.id) || ({} as Act));
const allCast = Array.from(
acts.reduce((acc, { preparation, preactivity, activity, postactivity }) => {
[preparation, preactivity, activity, postactivity].forEach((ap) => {
if (ap.activities) ap.activities.filter((a) => a.cast).forEach((a) => a.cast.forEach((id) => acc.add(id)));
});
return acc;
}, new Set<ID>())
)
.map((id) => cast.find((cast) => cast.id === id))
.filter((c) => c) as Cast[];

// console.log(url);
return m(
'.col.s12.m6.l4',
m(
'.card.large.cursor-pointer',
{
onclick: () => {
changePage(Pages.HOME, { id });
},
},
[
m('.card-image', [
m(
'a',
{
href: routingSvc.href(Pages.HOME, `?id=${id}`),
},
[m('img', { src: url, alt: name }), m('span.card-title.bold.sharpen', name)]
),
]),
m('.card-content', [
!url && m('span.card-title.bold.sharpen', { style: { 'white-space': 'wrap' } }, name),
description && m('p', description),
acts &&
m(
'p',
m(
'ol',
acts.map((act) => m('li', act.label))
)
),
allCast &&
allCast.length > 0 &&
m('p', m('span.bold', `${t('CAST')}: `), allCast.map(({ label }) => label).join(', ')),
]),
]
)
);
},
};
};

0 comments on commit 238124c

Please sign in to comment.