Skip to content

Commit

Permalink
Merge pull request #978 from Leo-Corporation/vNext
Browse files Browse the repository at this point in the history
Version 4.1.0.2404
  • Loading branch information
lpeyr authored Apr 16, 2024
2 parents 4efa3bd + 315bbf2 commit c697d84
Show file tree
Hide file tree
Showing 11 changed files with 1,139 additions and 396 deletions.
663 changes: 663 additions & 0 deletions components/preset-item.tsx

Large diffs are not rendered by default.

40 changes: 32 additions & 8 deletions components/timeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import useTranslation from "next-translate/useTranslation"

import { Activity } from "@/types/activity"
import { GetActivity, SortActivities } from "@/lib/browser-storage"
import { PasswordStrength } from "@/lib/password-gen"
import { GetPasswordStrength } from "@/lib/password-strength"
import ActivityItem from "./activity-item"

export interface TimelineProps {
Expand All @@ -11,6 +13,7 @@ export interface TimelineProps {
hide: boolean
index: number
refreshEvent: Function
filter: string
}

export default function Timeline(props: TimelineProps) {
Expand Down Expand Up @@ -41,19 +44,40 @@ export default function Timeline(props: TimelineProps) {
props.refreshEvent()
}

function matchFilter(password: string): boolean {
if (props.filter === "all") return true
let strength: PasswordStrength = GetPasswordStrength(password)
switch (strength) {
case PasswordStrength.VeryGood:
return props.filter === "verygood"
case PasswordStrength.Good:
return props.filter === "good"
case PasswordStrength.Medium:
return props.filter === "medium"
case PasswordStrength.Low:
return props.filter === "low"
default:
return true
}
}

return (
<section>
<h3 className="text-xl font-bold">{title}</h3>
<div className="border-l border-slate-400 dark:border-slate-600">
{els.map((el, i) => (
<ActivityItem
timeline_index={props.index}
index={i}
key={i}
deleteEvent={deleteElement}
activity={el}
hide={props.hide}
/>
<>
{matchFilter(el.content) && (
<ActivityItem
timeline_index={props.index}
index={i}
key={i}
deleteEvent={deleteElement}
activity={el}
hide={props.hide}
/>
)}
</>
))}
</div>
</section>
Expand Down
10 changes: 9 additions & 1 deletion locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,13 @@
"select-preset": "Select a preset",
"use-preset": "Use a preset",
"remove-preset": "Remove preset",
"hour-msg": "It is "
"hour-msg": "It is ",
"filter": "Filter",
"all": "All",
"apply": "Apply",
"edit": "Edit",
"edit-presets": "Edit preset",
"info": "Information",
"import": "Import",
"export": "Export"
}
10 changes: 9 additions & 1 deletion locales/fr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,13 @@
"select-preset": "Sélectionner un préréglage",
"use-preset": "Utiliser un préréglage",
"remove-preset": "Retirer le préréglage",
"hour-msg": "Il est "
"hour-msg": "Il est ",
"filter": "Filtrer",
"all": "Tout",
"apply": "Appliquer",
"edit": "Modifier",
"edit-presets": "Modifier le préréglage",
"info": "Informations",
"import": "Importer",
"export": "Exporter"
}
Loading

0 comments on commit c697d84

Please sign in to comment.