mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-07-24 23:40:22 +08:00
70 lines
3.0 KiB
TypeScript
70 lines
3.0 KiB
TypeScript
export type DataSyncEntryMode = 'sync' | 'schemaCompare' | 'dataCompare';
|
|
|
|
export type DataSyncEntryModePresentation = {
|
|
title: string;
|
|
description: string;
|
|
heroTitle: string;
|
|
heroDescription: string;
|
|
optionTitle: string;
|
|
tableSelectLabel: string;
|
|
analyzeButtonText: string;
|
|
closeButtonText: string;
|
|
badgeText: string;
|
|
resultTitle: string;
|
|
readOnly: boolean;
|
|
};
|
|
|
|
type DataSyncEntryModeTranslator = (key: string) => string;
|
|
|
|
const text = (key: string, t?: DataSyncEntryModeTranslator) => (t ? t(key) : key);
|
|
|
|
export const resolveDataSyncEntryModePresentation = (
|
|
entryMode: DataSyncEntryMode,
|
|
t?: DataSyncEntryModeTranslator,
|
|
): DataSyncEntryModePresentation => {
|
|
switch (entryMode) {
|
|
case 'schemaCompare':
|
|
return {
|
|
title: text('data_sync.entry_mode.schema_compare.title', t),
|
|
description: text('data_sync.entry_mode.schema_compare.description', t),
|
|
heroTitle: text('data_sync.entry_mode.schema_compare.title', t),
|
|
heroDescription: text('data_sync.entry_mode.schema_compare.hero_description', t),
|
|
optionTitle: text('data_sync.entry_mode.compare.option_title', t),
|
|
tableSelectLabel: text('data_sync.entry_mode.schema_compare.table_select_label', t),
|
|
analyzeButtonText: text('data_sync.entry_mode.compare.action.start', t),
|
|
closeButtonText: text('data_sync.action.close', t),
|
|
badgeText: text('data_sync.entry_mode.schema_compare.badge', t),
|
|
resultTitle: text('data_sync.entry_mode.compare.result_title', t),
|
|
readOnly: true,
|
|
};
|
|
case 'dataCompare':
|
|
return {
|
|
title: text('data_sync.entry_mode.data_compare.title', t),
|
|
description: text('data_sync.entry_mode.data_compare.description', t),
|
|
heroTitle: text('data_sync.entry_mode.data_compare.title', t),
|
|
heroDescription: text('data_sync.entry_mode.data_compare.hero_description', t),
|
|
optionTitle: text('data_sync.entry_mode.compare.option_title', t),
|
|
tableSelectLabel: text('data_sync.entry_mode.data_compare.table_select_label', t),
|
|
analyzeButtonText: text('data_sync.entry_mode.compare.action.start', t),
|
|
closeButtonText: text('data_sync.action.close', t),
|
|
badgeText: text('data_sync.entry_mode.data_compare.badge', t),
|
|
resultTitle: text('data_sync.entry_mode.compare.result_title', t),
|
|
readOnly: true,
|
|
};
|
|
default:
|
|
return {
|
|
title: text('data_sync.title.sync_workbench', t),
|
|
description: text('data_sync.title.sync_description', t),
|
|
heroTitle: text('data_sync.title.sync', t),
|
|
heroDescription: text('data_sync.entry_mode.sync.hero_description', t),
|
|
optionTitle: text('data_sync.title.sync_options', t),
|
|
tableSelectLabel: text('data_sync.help.select_tables', t),
|
|
analyzeButtonText: text('data_sync.action.analyze_diff', t),
|
|
closeButtonText: text('data_sync.action.close', t),
|
|
badgeText: text('data_sync.badge.sync_mode', t),
|
|
resultTitle: text('data_sync.step.result', t),
|
|
readOnly: false,
|
|
};
|
|
}
|
|
};
|