Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fix: make smart tags read-only, exchange emoji icons

Ilian Sapundshiev83b25298a206
diff --git a/app/components/TagContainer.tsx b/app/components/TagContainer.tsx
index af54e9953..57b5d077c 100644
--- a/app/components/TagContainer.tsx
+++ b/app/components/TagContainer.tsx
@@ -77,6 +77,8 @@ const TagContainer = React.memo((props: Props) => {
// Check if tag is plus code
let isGeoTag = false;
let isTagDate = false;
+ let isDateSmartTag = false;
+ let isGeoSmartTag = false;
if (!tagGroup) {
isGeoTag = isPlusCode(title); // || isLatLong
isTagDate = !isGeoTag && isDateTimeTag(title);
@@ -105,7 +107,10 @@ const TagContainer = React.memo((props: Props) => {
}
function getActionMenu() {
- if (props.isReadOnlyMode) {
+ if (
+ props.isReadOnlyMode ||
+ (tag.functionality && tag.functionality.length > 0)
+ ) {
return <div style={{ width: 10 }} />;
}
return tagMode === 'remove' ? (
@@ -132,6 +137,23 @@ const TagContainer = React.memo((props: Props) => {
);
}
+ if (tag.functionality && tag.functionality.length > 0) {
+ const tagFunc = tag.functionality;
+ if (
+ tagFunc === 'now' ||
+ tagFunc === 'today' ||
+ tagFunc === 'tomorrow' ||
+ tagFunc === 'yesterday' ||
+ tagFunc === 'currentMonth' ||
+ tagFunc === 'currentYear' ||
+ tagFunc === 'dateTagging'
+ ) {
+ isDateSmartTag = true;
+ } else if (tagFunc === 'geoTagging') {
+ isGeoSmartTag = true;
+ }
+ }
+
return (
<div
role="presentation"
@@ -187,7 +209,7 @@ const TagContainer = React.memo((props: Props) => {
}}
>
<span style={{ flexGrow: 1 }}>
- {isGeoTag && (
+ {(isGeoTag || isGeoSmartTag) && (
<PlaceIcon
style={{
color: tag.textcolor,
@@ -196,7 +218,7 @@ const TagContainer = React.memo((props: Props) => {
}}
/>
)}
- {isTagDate && (
+ {(isTagDate || isDateSmartTag) && (
<DateIcon
style={{
color: tag.textcolor,
diff --git a/app/reducers/smart-tags.ts b/app/reducers/smart-tags.ts
index f46b237bf..c3f2534b3 100644
--- a/app/reducers/smart-tags.ts
+++ b/app/reducers/smart-tags.ts
@@ -11,82 +11,74 @@ export default i18n => [
{
id: '05fbebfd-576c-4402-bd1b-e9900acd6661',
type: 'plain',
- title: 'πŸ—“οΈ ' + i18n.t('core:smartTagNow'),
+ title: i18n.t('core:smartTagNow'),
functionality: 'now',
description: i18n.t('core:smartTagNowDescription'),
color: '#4986e7',
- textcolor: '#ffffff',
- icon: ''
+ textcolor: '#ffffff'
},
{
id: '7505080c-b974-425f-8434-25cd08fb1013',
type: 'plain',
- title: 'πŸ—“οΈ ' + i18n.t('core:smartTagToday'),
+ title: i18n.t('core:smartTagToday'),
functionality: 'today',
description: i18n.t('core:smartTagTodayDescription'),
color: '#4986e7',
- textcolor: '#ffffff',
- icon: ''
+ textcolor: '#ffffff'
},
{
id: '841e55a0-3596-4417-9186-d035cbcb676c',
type: 'plain',
- title: 'πŸ—“οΈ ' + i18n.t('core:smartTagTomorrow'),
+ title: i18n.t('core:smartTagTomorrow'),
functionality: 'tomorrow',
description: i18n.t('core:smartTagTomorrowDescription'),
color: '#4986e7',
- textcolor: '#ffffff',
- icon: ''
+ textcolor: '#ffffff'
},
{
id: '3bf2bde9-cfa1-41cc-9154-debbf853e74c',
type: 'plain',
- title: 'πŸ—“οΈ ' + i18n.t('core:smartTagYesterday'),
+ title: i18n.t('core:smartTagYesterday'),
functionality: 'yesterday',
description: i18n.t('core:smartTagYesterdayDescription'),
color: '#4986e7',
- textcolor: '#ffffff',
- icon: ''
+ textcolor: '#ffffff'
},
{
id: 'e4618609-0940-4d78-b79f-7d4221df33e2',
type: 'plain',
- title: 'πŸ—“οΈ ' + i18n.t('core:smartTagMonth'),
+ title: i18n.t('core:smartTagMonth'),
functionality: 'currentMonth',
description: i18n.t('core:smartTagMonthDescription'),
color: '#4986e7',
- textcolor: '#ffffff',
- icon: ''
+ textcolor: '#ffffff'
},
{
id: 'b6d6c107-741e-423b-82a4-f00ae394dee4',
type: 'plain',
- title: 'πŸ—“οΈ ' + i18n.t('core:smartTagYear'),
+ title: i18n.t('core:smartTagYear'),
functionality: 'currentYear',
description: i18n.t('core:smartTagYearDescription'),
color: '#4986e7',
- textcolor: '#ffffff',
- icon: ''
+ textcolor: '#ffffff'
},
{
id: 'da9fd0e6-7921-4195-b8f9-dca80f132bab',
type: 'plain',
- title: 'πŸ“ ' + i18n.t('core:smartTagGeo'),
+ title: i18n.t('core:smartTagGeo'),
functionality: 'geoTagging',
description: i18n.t('core:smartTagGeoDescription'),
color: '#4986e7',
- textcolor: '#ffffff',
- icon: ''
+ textcolor: '#ffffff'
},
{
id: '67678ddd-4979-4489-8d2d-69a964af6b0d',
type: 'plain',
- title: 'πŸ“…οΈ ' + i18n.t('core:smartTagDate'),
+ title: i18n.t('core:smartTagDate'),
functionality: 'dateTagging',
description: i18n.t('core:smartTagDateDescription'),
color: '#4986e7',
- textcolor: '#ffffff',
- icon: ''
+ textcolor: '#ffffff'
}
]
}