Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"version": "yarn install --no-immutable && git add yarn.lock",
"postversion": "./scripts/push-tags-one-by-one.sh",
"dev:reset": "find . -type dir -name node_modules | xargs rm -rf && rm -rf yarn.lock && yarn install",
"workspaces:list": " yarn lerna list -all"
"workspaces:list": " yarn lerna list -all",
"i18n:extract": "mkdir -p po && yarn exec ttag extract packages/com.sncommunity.advanced-checklist/src packages/com.sncommunity.markdown-basic/app packages/com.sncommunity.bold-editor/app packages/org.standardnotes.token-vault/app packages/org.standardnotes.simple-task-editor/app packages/org.standardnotes.standard-sheets/app packages/org.standardnotes.code-editor/src packages/org.standardnotes.advanced-markdown-editor/src packages/org.standardnotes.plus-editor/src packages/dev.randombits.excalidraw/src node_modules/@standardnotes/component-relay/lib -o po/template.pot"
},
"devDependencies": {
"@lerna-lite/cli": "^4.10.5",
Expand All @@ -44,6 +45,8 @@
"prettier": "^2.6.2",
"sass": "^1.52.3",
"sass-loader": "^13.1.0",
"ttag": "^1.8.12",
"ttag-cli": "^1.11.2",
"typescript": "^4.7.3",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0",
Expand Down
8 changes: 5 additions & 3 deletions packages/com.sncommunity.advanced-checklist/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"eject": "react-scripts eject",
"build": "react-app-rewired build",
"test": "react-app-rewired test --watchAll=false --silent",
"format": "prettier --write 'src/**/*.{html,css,scss,js,jsx,ts,tsx,json}' README.md"
"format": "prettier --write 'src/**/*.{html,css,scss,js,jsx,ts,tsx,json}' README.md",
"i18n:extract": "mkdir -p po && yarn exec ttag extract src -o po/template.pot"
},
"eslintConfig": {
"extends": [
Expand Down Expand Up @@ -96,15 +97,16 @@
]
},
"dependencies": {
"@standardnotes/utils": "1.9.0"
"@standardnotes/utils": "1.9.0",
"ttag": "^1.8.12"
},
"devDependencies": {
"@reach/alert-dialog": "0.16.2",
"@reach/menu-button": "0.16.2",
"@reach/visually-hidden": "0.16.0",
"@react-hook/resize-observer": "^1.2.5",
"@reduxjs/toolkit": "1.8.0",
"@standardnotes/editor-kit": "standardnotes/editor-kit#626d7a6e63d4ada48be36676c466fea46d7709d3",
"@standardnotes/editor-kit": "standardnotes/editor-kit#46f753b8a00f581d2428687fd269ec299f9da2c2",
"@standardnotes/stylekit": "5.23.0",
"@testing-library/dom": "8.11.3",
"@testing-library/jest-dom": "5.16.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { AlertDialog, AlertDialogDescription, AlertDialogLabel } from '@reach/al
import React, { useRef } from 'react'

import { sanitizeHtmlString } from '@standardnotes/utils'
import { c } from 'ttag'

type ConfirmDialogProps = {
testId?: string
Expand All @@ -18,10 +19,10 @@ type ConfirmDialogProps = {
export const ConfirmDialog: React.FC<ConfirmDialogProps> = ({
testId,
title = '',
confirmButtonText = 'Confirm',
confirmButtonText = c('Plugins.AdvancedChecklist.Action').t`Confirm`,
confirmButtonStyle = 'info',
confirmButtonCb,
cancelButtonText = 'Cancel',
cancelButtonText = c('Plugins.AdvancedChecklist.Action').t`Cancel`,
cancelButtonCb,
children,
}) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { c } from 'ttag'

import { SectionModel } from '../features/tasks/tasks-slice'

export function getSectionDisplayName(section: SectionModel): string {
if (section.id === 'open-tasks') {
return c('Plugins.AdvancedChecklist.Label').t`Open`
}
if (section.id === 'completed-tasks') {
return c('Plugins.AdvancedChecklist.Label').t`Completed`
}
return section.name
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useState } from 'react'
import styled from 'styled-components'
import { c } from 'ttag'

import { useAppDispatch, useAppSelector } from '../../app/hooks'
import { ConfirmDialog } from '../../common/components'
Expand Down Expand Up @@ -45,10 +46,10 @@ const CompletedTasksActions: React.FC<CompletedTasksActionsProps> = ({ groupName
return (
<div data-testid="completed-tasks-actions">
<ActionButton onClick={() => setShowReopenDialog(true)} data-testid="reopen-completed-button">
Reopen Completed
{c('Plugins.AdvancedChecklist.Action').t`Reopen Completed`}
</ActionButton>
<ActionButton onClick={() => setShowDeleteDialog(true)} data-testid="delete-completed-button">
Delete Completed
{c('Plugins.AdvancedChecklist.Action').t`Delete Completed`}
</ActionButton>
{showReopenDialog && (
<ConfirmDialog
Expand All @@ -57,7 +58,7 @@ const CompletedTasksActions: React.FC<CompletedTasksActionsProps> = ({ groupName
confirmButtonCb={() => dispatch(openAllCompleted({ groupName }))}
cancelButtonCb={() => setShowReopenDialog(false)}
>
Are you sure you want to reopen completed tasks in the '<strong>{groupName}</strong>' group?
{c('Plugins.AdvancedChecklist.Confirmation').t`Are you sure you want to reopen completed tasks in the '${groupName}' group?`}
</ConfirmDialog>
)}
{showDeleteDialog && (
Expand All @@ -67,7 +68,8 @@ const CompletedTasksActions: React.FC<CompletedTasksActionsProps> = ({ groupName
confirmButtonCb={() => dispatch(deleteAllCompleted({ groupName }))}
cancelButtonCb={() => setShowDeleteDialog(false)}
>
Are you sure you want to delete completed tasks in the '<strong>{groupName}</strong>' group?
{c('Plugins.AdvancedChecklist.Confirmation')
.t`Are you sure you want to delete completed tasks in the '${groupName}' group?`}
</ConfirmDialog>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ChangeEvent, createRef, FocusEvent, KeyboardEvent, useState } from 'react'
import styled from 'styled-components'
import { c } from 'ttag'

import { useAppDispatch, useAppSelector } from '../../app/hooks'
import { tasksGroupAdded } from './tasks-slice'
Expand Down Expand Up @@ -125,7 +126,7 @@ const CreateGroup: React.FC = () => {
onBlur={handleBlur}
onChange={handleTextChange}
onKeyPress={handleKeyPress}
placeholder="Name your task group and press enter"
placeholder={c('Plugins.AdvancedChecklist.Placeholder').t`Name your task group and press enter`}
ref={inputRef}
spellCheck={spellCheckerEnabled}
textSize="big"
Expand All @@ -136,7 +137,7 @@ const CreateGroup: React.FC = () => {
<TutorialContainer>
<Tutorial>
<ArrowVector style={{ marginRight: 140, marginBottom: 12 }} />
<TutorialText>Get started by naming your first task group</TutorialText>
<TutorialText>{c('Plugins.AdvancedChecklist.Info').t`Get started by naming your first task group`}</TutorialText>
</Tutorial>
<EmptyContainer1 />
<EmptyContainer2 />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ChangeEvent, createRef, KeyboardEvent, useState } from 'react'
import styled from 'styled-components'
import { c } from 'ttag'
import { v4 as uuidv4 } from 'uuid'

import { useAppDispatch, useAppSelector, useDebouncedCallback } from '../../app/hooks'
Expand Down Expand Up @@ -67,7 +68,7 @@ const CreateTask: React.FC<CreateTaskProps> = ({ group }) => {
enterKeyHint={'go'}
onChange={onTextChange}
onKeyPress={handleKeyPress}
placeholder={'Type a task and press enter'}
placeholder={c('Plugins.AdvancedChecklist.Placeholder').t`Type a task and press enter`}
ref={inputRef}
spellCheck={spellCheckerEnabled}
value={taskDraft}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import '@reach/dialog/styles.css'

import { AlertDialog, AlertDialogDescription, AlertDialogLabel } from '@reach/alert-dialog'
import React, { useRef, useState } from 'react'
import { c } from 'ttag'

import { useAppDispatch, useAppSelector } from '../../app/hooks'
import { tasksGroupMerged } from './tasks-slice'
Expand Down Expand Up @@ -44,13 +45,15 @@ const MergeTaskGroups: React.FC<MergeTaskGroupsProps> = ({ groupName, handleClos
<div className="sk-panel">
<div className="sk-panel-content">
<div className="sk-panel-section">
<AlertDialogLabel className="sk-h3 sk-panel-section-title">Merging task groups</AlertDialogLabel>
<AlertDialogLabel className="sk-h3 sk-panel-section-title">
{c('Plugins.AdvancedChecklist.Title').t`Merging task groups`}
</AlertDialogLabel>

{mergeableGroups.length > 0 ? (
<>
<AlertDialogDescription className="sk-panel-row">
<p className="color-foreground">
Select which group you want to merge '<strong>{groupName}</strong>' into:
{c('Plugins.AdvancedChecklist.Info').t`Select which group you want to merge '${groupName}' into:`}
</p>
</AlertDialogDescription>
<fieldset className="flex flex-col" onChange={handleChange}>
Expand All @@ -65,17 +68,19 @@ const MergeTaskGroups: React.FC<MergeTaskGroupsProps> = ({ groupName, handleClos
) : (
<AlertDialogDescription>
<p className="color-foreground">
There are no other groups to merge '<strong>{groupName}</strong>' with.
{c('Plugins.AdvancedChecklist.Info').t`There are no other groups to merge '${groupName}' with.`}
</p>
</AlertDialogDescription>
)}

<div className="flex my-1 mt-4">
<button className="sn-button small neutral" onClick={handleClose} ref={cancelRef}>
{!mergeWith ? 'Close' : 'Cancel'}
{!mergeWith
? c('Plugins.AdvancedChecklist.Action').t`Close`
: c('Plugins.AdvancedChecklist.Action').t`Cancel`}
</button>
<button className="sn-button small ml-2 info" onClick={handleMergeGroups}>
Merge groups
{c('Plugins.AdvancedChecklist.Action').t`Merge groups`}
</button>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import '@reach/dialog/styles.css'

import { AlertDialog, AlertDialogLabel } from '@reach/alert-dialog'
import React, { useRef } from 'react'
import { c } from 'ttag'

import { useAppDispatch } from '../../app/hooks'
import { tasksLegacyContentMigrated } from './tasks-slice'
Expand All @@ -27,15 +28,16 @@ const MigrateLegacyContent: React.FC = () => {
<div className="sk-panel-content">
<div className="sk-panel-section">
<AlertDialogLabel className="sk-h3 sk-panel-section-title">
Are you sure you want to migrate legacy content to the new format?
{c('Plugins.AdvancedChecklist.Confirmation')
.t`Are you sure you want to migrate legacy content to the new format?`}
</AlertDialogLabel>

<div className="flex my-1">
<button className="sn-button small neutral" onClick={handleCancel} ref={cancelRef}>
Cancel
{c('Plugins.AdvancedChecklist.Action').t`Cancel`}
</button>
<button className="sn-button small ml-2 info" onClick={handleMigrate}>
Migrate
{c('Plugins.AdvancedChecklist.Action').t`Migrate`}
</button>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { c, msgid } from 'ttag'

import {
getPercentage,
getTaskArrayFromGroupedTasks,
Expand Down Expand Up @@ -25,12 +27,17 @@ const GroupSummary: React.FC<GroupSummaryProps> = ({ groups }) => {
}

const remainingGroups = totalGroups - groupsToPreview.length
const groupNoun = remainingGroups > 1 ? 'groups' : 'group'

const remainingGroupsLabel = c('Plugins.AdvancedChecklist.Info').ngettext(
msgid`And ${remainingGroups} other group`,
`And ${remainingGroups} other groups`,
remainingGroups,
)

return (
<>
<div className="my-2">
{groupsToPreview.map((group, index) => {
{groupsToPreview.map((group) => {
const totalTasks = group.tasks.length
const totalCompletedTasks = group.tasks.filter((task) => task.completed === true).length

Expand All @@ -44,11 +51,7 @@ const GroupSummary: React.FC<GroupSummaryProps> = ({ groups }) => {
)
})}
</div>
{remainingGroups > 0 && (
<p data-testid="groups-remaining">
And {remainingGroups} other {groupNoun}
</p>
)}
{remainingGroups > 0 && <p data-testid="groups-remaining">{remainingGroupsLabel}</p>}
</>
)
}
Expand All @@ -63,16 +66,20 @@ const NotePreview: React.FC<NotePreviewProps> = ({ groupedTasks }) => {
const percentage = getPercentage(allTasks.length, completedTasks.length)
const roundedPercentage = Math.floor(percentage / 10) * 10

const completedSummary = c('Plugins.AdvancedChecklist.Info').ngettext(
msgid`${completedTasks.length}/${allTasks.length} task completed`,
`${completedTasks.length}/${allTasks.length} tasks completed`,
allTasks.length,
)

return (
<>
<div className="flex flex-grow items-center mb-3">
<svg data-testid="circular-progress-bar" className="sk-circular-progress" viewBox="0 0 18 18">
<circle className="background" />
<circle className={`progress p-${roundedPercentage}`} />
</svg>
<Title>
{completedTasks.length}/{allTasks.length} tasks completed
</Title>
<Title>{completedSummary}</Title>
</div>
<GroupSummary groups={groupedTasks} />
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import '@reach/dialog/styles.css'

import { AlertDialog, AlertDialogDescription, AlertDialogLabel } from '@reach/alert-dialog'
import React, { KeyboardEvent, useRef, useState } from 'react'
import { c } from 'ttag'

import { useAppDispatch } from '../../app/hooks'
import { TextInput } from '../../common/components'
Expand Down Expand Up @@ -44,7 +45,7 @@ const RenameTaskGroups: React.FC<RenameTaskGroupsProps> = ({ groupName, handleCl
<div className="sk-panel-content">
<div className="sk-panel-section">
<AlertDialogLabel className="sk-h3 sk-panel-section-title">
Renaming group '<strong>{groupName}</strong>':
{c('Plugins.AdvancedChecklist.Title').t`Renaming group '${groupName}':`}
</AlertDialogLabel>

<AlertDialogDescription>
Expand All @@ -53,21 +54,23 @@ const RenameTaskGroups: React.FC<RenameTaskGroupsProps> = ({ groupName, handleCl
autoFocus
onChange={handleChange}
onKeyPress={handleKeyPress}
placeholder="Enter new group name"
placeholder={c('Plugins.AdvancedChecklist.Placeholder').t`Enter new group name`}
value={renameTo}
/>
</AlertDialogDescription>

<div className="flex my-1 mt-4">
<button className="sn-button small neutral" onClick={handleClose} ref={cancelRef}>
{renameTo.length === 0 ? 'Close' : 'Cancel'}
{renameTo.length === 0
? c('Plugins.AdvancedChecklist.Action').t`Close`
: c('Plugins.AdvancedChecklist.Action').t`Cancel`}
</button>
<button
className="sn-button small ml-2 info"
disabled={renameTo.length === 0}
onClick={handleRenameGroup}
>
Rename
{c('Plugins.AdvancedChecklist.Action').t`Rename`}
</button>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Menu, MenuButton, MenuItem, MenuList } from '@reach/menu-button'
import VisuallyHidden from '@reach/visually-hidden'
import { useState } from 'react'
import { c } from 'ttag'

import { useAppDispatch } from '../../app/hooks'
import { tasksGroupDeleted } from './tasks-slice'
Expand All @@ -27,34 +28,34 @@ const TaskGroupOptions: React.FC<TaskGroupOptionsProps> = ({ groupName }) => {
<>
<Menu>
<MenuButton data-testid="task-group-options" className="sn-icon-button">
<VisuallyHidden>Options for '{groupName}' group</VisuallyHidden>
<VisuallyHidden>{c('Plugins.AdvancedChecklist.AriaLabel').t`Options for '${groupName}' group`}</VisuallyHidden>
<MoreIcon />
</MenuButton>
<MenuList>
<MenuItem data-testid="delete-task-group" onSelect={() => setShowDeleteDialog(true)}>
<TrashIcon />
<span className="px-1">Delete group</span>
<span className="px-1">{c('Plugins.AdvancedChecklist.Action').t`Delete group`}</span>
</MenuItem>
<MenuItem data-testid="merge-task-group" onSelect={() => setShowMergeDialog(true)}>
<MergeIcon />
<span className="px-1">Merge into another group</span>
<span className="px-1">{c('Plugins.AdvancedChecklist.Action').t`Merge into another group`}</span>
</MenuItem>
<MenuItem data-testid="rename-task-group" onSelect={() => setShowRenameDialog(true)}>
<RenameIcon />
<span className="px-1">Rename</span>
<span className="px-1">{c('Plugins.AdvancedChecklist.Action').t`Rename`}</span>
</MenuItem>
</MenuList>
</Menu>
{showDeleteDialog && (
<ConfirmDialog
testId="delete-task-group-dialog"
title="Delete group"
confirmButtonText="Delete"
title={c('Plugins.AdvancedChecklist.Title').t`Delete group`}
confirmButtonText={c('Plugins.AdvancedChecklist.Action').t`Delete`}
confirmButtonStyle="danger"
confirmButtonCb={() => dispatch(tasksGroupDeleted({ groupName }))}
cancelButtonCb={() => setShowDeleteDialog(false)}
>
Are you sure you want to delete the group '<strong>{groupName}</strong>'?
{c('Plugins.AdvancedChecklist.Confirmation').t`Are you sure you want to delete the group '${groupName}'?`}
</ConfirmDialog>
)}
{showMergeDialog && <MergeTaskGroups groupName={groupName} handleClose={() => setShowMergeDialog(false)} />}
Expand Down
Loading
Loading