2023-01-19 19:19:06 +02:00
|
|
|
import * as React from 'react';
|
|
|
|
import time from '@joplin/lib/time';
|
|
|
|
import { themeStyle } from '@joplin/lib/theme';
|
|
|
|
import { NoteEntity } from '@joplin/lib/services/database/types';
|
|
|
|
import { AppState } from '../app.reducer';
|
2018-03-18 01:51:15 +02:00
|
|
|
const { connect } = require('react-redux');
|
|
|
|
|
2023-01-19 19:19:06 +02:00
|
|
|
interface Props {
|
|
|
|
themeId: number;
|
|
|
|
note: NoteEntity;
|
|
|
|
}
|
|
|
|
|
|
|
|
class NoteStatusBarComponent extends React.Component<Props> {
|
2023-03-06 16:22:01 +02:00
|
|
|
public style() {
|
2020-09-15 15:01:07 +02:00
|
|
|
const theme = themeStyle(this.props.themeId);
|
2018-03-18 01:51:15 +02:00
|
|
|
|
2020-03-14 01:46:14 +02:00
|
|
|
const style = {
|
2023-06-01 13:02:36 +02:00
|
|
|
root: { ...theme.textStyle, backgroundColor: theme.backgroundColor,
|
|
|
|
color: theme.colorFaded },
|
2018-03-18 01:51:15 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
return style;
|
|
|
|
}
|
|
|
|
|
2023-03-06 16:22:01 +02:00
|
|
|
public render() {
|
2018-03-18 01:51:15 +02:00
|
|
|
const note = this.props.note;
|
2019-07-29 14:13:23 +02:00
|
|
|
return <div style={this.style().root}>{time.formatMsToLocal(note.user_updated_time)}</div>;
|
2018-03-18 01:51:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-19 19:19:06 +02:00
|
|
|
const mapStateToProps = (state: AppState) => {
|
2018-03-18 01:51:15 +02:00
|
|
|
return {
|
|
|
|
// notes: state.notes,
|
|
|
|
// folders: state.folders,
|
|
|
|
// selectedNoteIds: state.selectedNoteIds,
|
2020-09-15 15:01:07 +02:00
|
|
|
themeId: state.settings.theme,
|
2018-03-18 01:51:15 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const NoteStatusBar = connect(mapStateToProps)(NoteStatusBarComponent);
|
|
|
|
|
2023-01-19 19:19:06 +02:00
|
|
|
export default NoteStatusBar;
|