mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-05-08 14:24:39 +02:00
Merge branch 'dev' of github.com:estruyf/vscode-front-matter into dev
This commit is contained in:
@@ -110,6 +110,7 @@
|
||||
"dashboard.dataView.dataView.getStarted": "Select a data type to get started",
|
||||
"dashboard.dataView.dataView.noDataFiles": "No data files found",
|
||||
"dashboard.dataView.dataView.getStarted.link": "Read more to get started using data files",
|
||||
"dashboard.dataView.dataView.update.message": "Updated your data entries",
|
||||
|
||||
"dashboard.dataView.emptyView.heading": "Select your date type first",
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ import { ChevronRightIcon, CircleStackIcon } from '@heroicons/react/24/outline';
|
||||
import { DataType } from '../../../models/DataType';
|
||||
import { TelemetryEvent } from '../../../constants';
|
||||
import { NavigationItem } from '../Layout';
|
||||
import useThemeColors from '../../hooks/useThemeColors';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../../../localization';
|
||||
|
||||
@@ -32,7 +31,6 @@ export const DataView: React.FunctionComponent<IDataViewProps> = (
|
||||
const [selectedIndex, setSelectedIndex] = useState<number | null>(null);
|
||||
const [dataEntries, setDataEntries] = useState<any | any[] | null>(null);
|
||||
const settings = useRecoilValue(SettingsSelector);
|
||||
const { getColors } = useThemeColors();
|
||||
|
||||
const setSchema = (dataFile: DataFile) => {
|
||||
setSelectedData(dataFile);
|
||||
@@ -109,7 +107,7 @@ export const DataView: React.FunctionComponent<IDataViewProps> = (
|
||||
entries: data
|
||||
});
|
||||
|
||||
Messenger.send(DashboardMessage.showNotification, 'Updated your data entries');
|
||||
Messenger.send(DashboardMessage.showNotification, l10n.t(LocalizationKey.dashboardDataViewDataViewUpdateMessage));
|
||||
},
|
||||
[selectedData]
|
||||
);
|
||||
@@ -167,27 +165,15 @@ export const DataView: React.FunctionComponent<IDataViewProps> = (
|
||||
<div className="relative w-full flex-grow mx-auto overflow-hidden">
|
||||
<div className={`flex w-64 flex-col absolute inset-y-0`}>
|
||||
<aside
|
||||
className={`flex flex-col flex-grow overflow-y-auto border-r py-6 px-4 overflow-auto ${getColors(
|
||||
'border-gray-200 dark:border-vulcan-300',
|
||||
'border-[var(--frontmatter-border)]'
|
||||
)
|
||||
}`}
|
||||
className={`flex flex-col flex-grow overflow-y-auto border-r py-6 px-4 overflow-auto border-[var(--frontmatter-border)]`}
|
||||
>
|
||||
<h2 className={`text-lg ${getColors(
|
||||
`text-gray-500 dark:text-whisper-900`,
|
||||
`text-[var(--frontmatter-text)]`
|
||||
)
|
||||
}`}>
|
||||
<h2 className={`text-lg text-[var(--frontmatter-text)]`}>
|
||||
{l10n.t(LocalizationKey.dashboardDataViewDataViewSelect)}
|
||||
</h2>
|
||||
|
||||
<nav className={`flex-1 py-4 -mx-4`}>
|
||||
<div
|
||||
className={`divide-y border-t border-b ${getColors(
|
||||
`divide-gray-200 dark:divide-vulcan-300 border-gray-200 dark:border-vulcan-300`,
|
||||
`divide-[var(--frontmatter-border)] border-[var(--frontmatter-border)]`
|
||||
)
|
||||
}`}
|
||||
className={`divide-y border-t border-b divide-[var(--frontmatter-border)] border-[var(--frontmatter-border)]`}
|
||||
>
|
||||
{dataFiles &&
|
||||
dataFiles.length > 0 &&
|
||||
@@ -211,17 +197,9 @@ export const DataView: React.FunctionComponent<IDataViewProps> = (
|
||||
<>
|
||||
{!selectedData.singleEntry && (
|
||||
<div
|
||||
className={`w-1/3 py-6 px-4 flex-1 border-r overflow-auto ${getColors(
|
||||
`border-gray-200 dark:border-vulcan-300`,
|
||||
`border-[var(--frontmatter-border)]`
|
||||
)
|
||||
}`}
|
||||
className={`w-1/3 py-6 px-4 flex-1 border-r overflow-auto border-[var(--frontmatter-border)]`}
|
||||
>
|
||||
<h2 className={`text-lg ${getColors(
|
||||
`text-gray-500 dark:text-whisper-900`,
|
||||
`text-[var(--frontmatter-text)]`
|
||||
)
|
||||
}`}>
|
||||
<h2 className={`text-lg text-[var(--frontmatter-text)]`}>
|
||||
{l10n.t(LocalizationKey.dashboardDataViewDataViewTitle, selectedData?.title?.toLowerCase() || '')}
|
||||
</h2>
|
||||
|
||||
@@ -247,7 +225,7 @@ export const DataView: React.FunctionComponent<IDataViewProps> = (
|
||||
</>
|
||||
) : (
|
||||
<div className={`flex flex-col items-center justify-center`}>
|
||||
<p className={getColors(`text-gray-500 dark:text-whisper-900`, `text-[var(--frontmatter-text)]`)}>
|
||||
<p className={`text-[var(--frontmatter-text)]`}>
|
||||
{l10n.t(LocalizationKey.dashboardDataViewDataViewEmpty, selectedData.title.toLowerCase())}
|
||||
</p>
|
||||
</div>
|
||||
@@ -259,7 +237,7 @@ export const DataView: React.FunctionComponent<IDataViewProps> = (
|
||||
className={`${selectedData.singleEntry ? 'w-full' : 'w-2/3'
|
||||
} py-6 px-4 overflow-auto`}
|
||||
>
|
||||
<h2 className={`text-lg ${getColors(`text-gray-500 dark:text-whisper-900`, `text-[var(--frontmatter-text)]`)}`}>
|
||||
<h2 className={`text-lg text-[var(--frontmatter-text)]`}>
|
||||
{l10n.t(LocalizationKey.dashboardDataViewDataViewCreateOrModify, selectedData.title.toLowerCase())}
|
||||
</h2>
|
||||
{selectedData ? (
|
||||
@@ -281,16 +259,12 @@ export const DataView: React.FunctionComponent<IDataViewProps> = (
|
||||
</div>
|
||||
) : (
|
||||
<div className="w-full h-full flex items-center justify-center">
|
||||
<div className={`flex flex-col items-center ${getColors(
|
||||
'text-gray-500 dark:text-whisper-900',
|
||||
'text-[var(--frontmatter-text)]'
|
||||
)
|
||||
}`}>
|
||||
<div className={`flex flex-col items-center text-[var(--frontmatter-text)]`}>
|
||||
<CircleStackIcon className="w-32 h-32" />
|
||||
<p className="text-3xl mt-2">{l10n.t(LocalizationKey.dashboardDataViewDataViewNoDataFiles)}</p>
|
||||
<p className="text-xl mt-4">
|
||||
<a
|
||||
className={getColors(`text-teal-700 hover:text-teal-900`, `text-[var(--frontmatter-link)] hover:text-[var(--frontmatter-link-hover)]`)}
|
||||
className={`text-[var(--frontmatter-link)] hover:text-[var(--frontmatter-link-hover)]`}
|
||||
href={`https://frontmatter.codes/docs/dashboard#data-files-view`}
|
||||
title={l10n.t(LocalizationKey.dashboardDataViewDataViewGetStartedLink)}
|
||||
>
|
||||
|
||||
@@ -10,15 +10,18 @@ import { ArticleHelper, ContentType, Extension, Logger, Settings } from '../../h
|
||||
import {
|
||||
COMMAND_NAME,
|
||||
DefaultFields,
|
||||
FEATURE_FLAG,
|
||||
SETTING_COMMA_SEPARATED_FIELDS,
|
||||
SETTING_DATE_FORMAT,
|
||||
SETTING_GLOBAL_ACTIVE_MODE,
|
||||
SETTING_GLOBAL_MODES,
|
||||
SETTING_SEO_TITLE_FIELD,
|
||||
SETTING_TAXONOMY_CONTENT_TYPES
|
||||
} from '../../constants';
|
||||
import { Article, Preview } from '../../commands';
|
||||
import { ParsedFrontMatter } from '../../parsers';
|
||||
import { processKnownPlaceholders } from '../../helpers/PlaceholderHelper';
|
||||
import { Field, PostMessageData } from '../../models';
|
||||
import { Field, Mode, PostMessageData } from '../../models';
|
||||
import { encodeEmoji, fieldWhenClause } from '../../utils';
|
||||
import { PanelProvider } from '../../panelWebView/PanelProvider';
|
||||
import { MessageHandlerData } from '@estruyf/vscode';
|
||||
@@ -144,6 +147,22 @@ export class DataListener extends BaseListener {
|
||||
* Retrieve the information about the registered folders and its files
|
||||
*/
|
||||
public static async getFoldersAndFiles() {
|
||||
const mode = Settings.get<string | null>(SETTING_GLOBAL_ACTIVE_MODE);
|
||||
const modes = Settings.get<Mode[]>(SETTING_GLOBAL_MODES);
|
||||
|
||||
if (mode && modes && modes.length > 0) {
|
||||
const crntMode = modes.find((m) => m.id === mode);
|
||||
if (crntMode) {
|
||||
const recentlyModified = crntMode.features.find(
|
||||
(f) => f === FEATURE_FLAG.panel.recentlyModified
|
||||
);
|
||||
if (!recentlyModified) {
|
||||
this.sendMsg(Command.folderInfo, null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const folders = (await Folders.getInfo(FILE_LIMIT)) || null;
|
||||
|
||||
this.sendMsg(Command.folderInfo, folders);
|
||||
|
||||
@@ -371,6 +371,10 @@ export enum LocalizationKey {
|
||||
* Read more to get started using data files
|
||||
*/
|
||||
dashboardDataViewDataViewGetStartedLink = 'dashboard.dataView.dataView.getStarted.link',
|
||||
/**
|
||||
* Updated your data entries
|
||||
*/
|
||||
dashboardDataViewDataViewUpdateMessage = 'dashboard.dataView.dataView.update.message',
|
||||
/**
|
||||
* Select your date type first
|
||||
*/
|
||||
|
||||
@@ -50,7 +50,7 @@ export const GitAction: React.FunctionComponent<IGitActionProps> = ({
|
||||
onClick={pull}
|
||||
title={
|
||||
<div className="git_actions__sync">
|
||||
<ArrowPathIcon className={isSyncing ? 'animate-spin' : ''} />
|
||||
<ArrowPathIcon className={isSyncing ? 'animate-reverse-spin' : ''} />
|
||||
<span>
|
||||
{l10n.t(LocalizationKey.commonSync)}
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user