diff --git a/services/web/frontend/extracted-translations.json b/services/web/frontend/extracted-translations.json index a85966ac07..5b5496619c 100644 --- a/services/web/frontend/extracted-translations.json +++ b/services/web/frontend/extracted-translations.json @@ -38,6 +38,7 @@ "all_projects": "", "also": "", "an_error_occurred_when_verifying_the_coupon_code": "", + "anonymous": "", "anyone_with_link_can_edit": "", "anyone_with_link_can_view": "", "approaching_compile_timeout_limit_upgrade_for_more_compile_time": "", @@ -246,6 +247,10 @@ "faster_compiles_feedback_seems_same": "", "faster_compiles_feedback_seems_slower": "", "faster_compiles_feedback_thanks": "", + "file_action_created": "", + "file_action_deleted": "", + "file_action_edited": "", + "file_action_renamed": "", "file_already_exists": "", "file_already_exists_in_this_location": "", "file_name": "", @@ -347,6 +352,12 @@ "hide_document_preamble": "", "hide_outline": "", "history": "", + "history_entry_origin_dropbox": "", + "history_entry_origin_git": "", + "history_entry_origin_github": "", + "history_entry_origin_upload": "", + "history_label_created_by": "", + "history_label_project_current_state": "", "history_view_a11y_description": "", "history_view_all": "", "history_view_labels": "", @@ -551,6 +562,7 @@ "other_output_files": "", "overall_theme": "", "overleaf": "", + "overleaf_history_system": "", "overleaf_labs": "", "overwrite": "", "owned_by_x": "", @@ -947,6 +959,7 @@ "x_price_per_year": "", "year": "", "yes_move_me_to_personal_plan": "", + "you": "", "you_already_have_a_subscription": "", "you_are_a_manager_and_member_of_x_plan_as_member_of_group_subscription_y_administered_by_z": "", "you_are_a_manager_of_commons_at_institution_x": "", diff --git a/services/web/frontend/js/features/history/components/change-list/all-history-list.tsx b/services/web/frontend/js/features/history/components/change-list/all-history-list.tsx new file mode 100644 index 0000000000..ee97b6a237 --- /dev/null +++ b/services/web/frontend/js/features/history/components/change-list/all-history-list.tsx @@ -0,0 +1,22 @@ +import { Fragment } from 'react' +import { useHistoryContext } from '../../context/history-context' +import HistoryVersion from './history-version' + +function AllHistoryList() { + const { updates } = useHistoryContext() + + return ( + <> + {updates.map((update, index) => ( + + {update.meta.first_in_day && index > 0 && ( +
+ )} + +
+ ))} + + ) +} + +export default AllHistoryList diff --git a/services/web/frontend/js/features/history/components/change-list/change-list.tsx b/services/web/frontend/js/features/history/components/change-list/change-list.tsx index f93018de73..4aad40c733 100644 --- a/services/web/frontend/js/features/history/components/change-list/change-list.tsx +++ b/services/web/frontend/js/features/history/components/change-list/change-list.tsx @@ -1,10 +1,11 @@ import usePersistedState from '../../../../shared/hooks/use-persisted-state' import ToggleSwitch from './toggle-switch' -import Main from './main' +import AllHistoryList from './all-history-list' +import LabelsList from './labels-list' import { useHistoryContext } from '../../context/history-context' function ChangeList() { - const { projectId, isError } = useHistoryContext() + const { projectId, error } = useHistoryContext() const [labelsOnly, setLabelsOnly] = usePersistedState( `history.userPrefs.showOnlyLabels.${projectId}`, false @@ -12,14 +13,16 @@ function ChangeList() { return ( ) } diff --git a/services/web/frontend/js/features/history/components/change-list/changes.tsx b/services/web/frontend/js/features/history/components/change-list/changes.tsx new file mode 100644 index 0000000000..5ac4825b07 --- /dev/null +++ b/services/web/frontend/js/features/history/components/change-list/changes.tsx @@ -0,0 +1,39 @@ +import { useTranslation } from 'react-i18next' +import { getProjectOpDoc } from '../../utils/history-details' +import { LoadedUpdate } from '../../services/types/update' + +type ChangesProps = { + pathNames: LoadedUpdate['pathnames'] + projectOps: LoadedUpdate['project_ops'] +} + +function Changes({ pathNames, projectOps }: ChangesProps) { + const { t } = useTranslation() + + return ( +
    + {pathNames.map(pathName => ( +
  1. +
    + {t('file_action_edited')} +
    +
    {pathName}
    +
  2. + ))} + {projectOps.map((op, index) => ( +
  3. +
    + {op.rename && t('file_action_renamed')} + {op.add && t('file_action_created')} + {op.remove && t('file_action_deleted')} +
    +
    + {getProjectOpDoc(op)} +
    +
  4. + ))} +
+ ) +} + +export default Changes diff --git a/services/web/frontend/js/features/history/components/change-list/history-version.tsx b/services/web/frontend/js/features/history/components/change-list/history-version.tsx new file mode 100644 index 0000000000..fc2beb1391 --- /dev/null +++ b/services/web/frontend/js/features/history/components/change-list/history-version.tsx @@ -0,0 +1,49 @@ +import LabelBadges from './label-badges' +import Changes from './changes' +import MetadataUsersList from './metadata-users-list' +import Origin from './origin' +import { useUserContext } from '../../../../shared/context/user-context' +import { relativeDate, formatTime } from '../../../utils/format-date' +import { LoadedUpdate } from '../../services/types/update' + +type HistoryEntryProps = { + update: LoadedUpdate +} + +function HistoryVersion({ update }: HistoryEntryProps) { + const { id: currentUserId } = useUserContext() + + return ( +
+ {update.meta.first_in_day && ( + + )} +
+
+ + + + + +
+
+
+ ) +} + +export default HistoryVersion diff --git a/services/web/frontend/js/features/history/components/change-list/label-badges.tsx b/services/web/frontend/js/features/history/components/change-list/label-badges.tsx new file mode 100644 index 0000000000..4958142489 --- /dev/null +++ b/services/web/frontend/js/features/history/components/change-list/label-badges.tsx @@ -0,0 +1,96 @@ +import { Fragment } from 'react' +import { useTranslation } from 'react-i18next' +import Icon from '../../../../shared/components/icon' +import Tooltip from '../../../../shared/components/tooltip' +import { useHistoryContext } from '../../context/history-context' +import { isPseudoLabel } from '../../utils/label' +import { formatDate } from '../../../../utils/dates' +import { orderBy } from 'lodash' +import { Label, PseudoCurrentStateLabel } from '../../services/types/update' + +type LabelBadgesProps = { + showTooltip: boolean + currentUserId: string + labels: Array