mirror of
https://github.com/mue/mue.git
synced 2026-07-24 09:17:24 +02:00
Refactor state updates for consistency and readability across components
- Simplified state updates in Background, Favourite, PhotoInformation, GreetingOptions, Added, Browse, About, Overview, Navbar, Apps, Notes, QuickLinksOptions, Quote, and QuoteOptions components by consolidating multiple lines into single line updates. - Improved readability by reducing unnecessary line breaks and maintaining consistent formatting in JSX elements. - Enhanced maintainability by ensuring uniformity in how state is set and how JSX is structured.
This commit is contained in:
@@ -345,11 +345,7 @@ class About extends PureComponent {
|
||||
</div>
|
||||
<div
|
||||
className="settingsRow"
|
||||
style={{
|
||||
flexFlow: 'column',
|
||||
alignItems: 'flex-start',
|
||||
minHeight: '10px',
|
||||
}}
|
||||
style={{ flexFlow: 'column', alignItems: 'flex-start', minHeight: '10px' }}
|
||||
>
|
||||
<span className="title">
|
||||
{variables.getMessage('modals.main.settings.sections.about.photographers')}
|
||||
|
||||
@@ -40,10 +40,7 @@ const widget_name = {
|
||||
const SortableItem = ({ id }) => {
|
||||
const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ id });
|
||||
|
||||
const style = {
|
||||
transform: CSS.Transform.toString(transform),
|
||||
transition,
|
||||
};
|
||||
const style = { transform: CSS.Transform.toString(transform), transition };
|
||||
|
||||
return (
|
||||
<li ref={setNodeRef} style={style} {...attributes} {...listeners} className="sortableItem">
|
||||
@@ -77,9 +74,7 @@ const Overview = () => {
|
||||
|
||||
const sensors = useSensors(
|
||||
useSensor(PointerSensor),
|
||||
useSensor(KeyboardSensor, {
|
||||
coordinateGetter: sortableKeyboardCoordinates,
|
||||
}),
|
||||
useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates }),
|
||||
);
|
||||
|
||||
const handleDragEnd = (event) => {
|
||||
@@ -135,11 +130,7 @@ const Overview = () => {
|
||||
const data = await response.json();
|
||||
data.date = new window.Date(data.date).toLocaleDateString(
|
||||
variables.languagecode.replace('_', '-'),
|
||||
{
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
},
|
||||
{ year: 'numeric', month: 'long', day: 'numeric' },
|
||||
);
|
||||
setNews(data);
|
||||
setNewsDone(true);
|
||||
@@ -187,7 +178,11 @@ const Overview = () => {
|
||||
<span className="title">
|
||||
{variables.getMessage('modals.main.settings.sections.order.title')}
|
||||
</span>
|
||||
<DndContext sensors={sensors} collisionDetection={closestCenter} onDragEnd={handleDragEnd}>
|
||||
<DndContext
|
||||
sensors={sensors}
|
||||
collisionDetection={closestCenter}
|
||||
onDragEnd={handleDragEnd}
|
||||
>
|
||||
<SortableContext items={items} strategy={verticalListSortingStrategy}>
|
||||
<ul className="sortableContainer">
|
||||
{items.map((value) => {
|
||||
|
||||
Reference in New Issue
Block a user