Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.

Commit 6d1ce60

Browse files
authored
feat: enhancements and fixes (#810)
1 parent f64f202 commit 6d1ce60

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+352
-237
lines changed

packages/core/dev-test/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ collections:
8282
create: true
8383
editor:
8484
frame: false
85+
size: half
8586
fields:
8687
- label: Question
8788
name: title

packages/core/src/backend.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
hasI18n,
1919
} from './lib/i18n';
2020
import { getBackend, invokeEvent } from './lib/registry';
21-
import { sanitizeChar } from './lib/urlHelper';
21+
import { joinUrlPath, sanitizeChar } from './lib/urlHelper';
2222
import {
2323
CURSOR_COMPATIBILITY_SYMBOL,
2424
Cursor,
@@ -39,7 +39,11 @@ import {
3939
selectInferredField,
4040
selectMediaFolders,
4141
} from './lib/util/collection.util';
42-
import { selectMediaFilePath, selectMediaFilePublicPath } from './lib/util/media.util';
42+
import {
43+
DRAFT_MEDIA_FILES,
44+
selectMediaFilePath,
45+
selectMediaFilePublicPath,
46+
} from './lib/util/media.util';
4347
import { selectCustomPath, slugFromCustomPath } from './lib/util/nested.util';
4448
import { set } from './lib/util/object.util';
4549
import { dateParsers, expandPath, extractTemplateVars } from './lib/widgets/stringTemplate';
@@ -84,7 +88,19 @@ function updateAssetProxies(
8488
// update media files path based on entry path
8589
const oldPath = asset.path;
8690
entryDraft.entry.path = path;
87-
const newPath = selectMediaFilePath(config, collection, entryDraft.entry, oldPath, asset.field);
91+
92+
const folderPath = joinUrlPath(
93+
collection && 'folder' in collection ? collection.folder : '',
94+
DRAFT_MEDIA_FILES,
95+
);
96+
97+
const newPath = selectMediaFilePath(
98+
config,
99+
collection,
100+
entryDraft.entry,
101+
oldPath.replace(folderPath, ''),
102+
asset.field,
103+
);
88104
asset.path = newPath;
89105
});
90106
}

packages/core/src/components/collections/CollectionSearch.tsx

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -146,25 +146,25 @@ const CollectionSearch = ({
146146
type="text"
147147
id="first_name"
148148
className="
149-
block
150-
w-full
151-
p-1.5
152-
pl-10
153-
text-sm
154-
text-gray-900
155-
border
156-
border-gray-300
157-
rounded-lg
158-
bg-gray-50
159-
focus-visible:outline-none
160-
focus:ring-4
161-
focus:ring-gray-200
162-
dark:bg-gray-700
163-
dark:border-gray-600
164-
dark:placeholder-gray-400
165-
dark:text-white
166-
dark:focus:ring-slate-700
167-
"
149+
block
150+
w-full
151+
p-1.5
152+
pl-10
153+
text-sm
154+
text-gray-800
155+
border
156+
border-gray-300
157+
rounded-lg
158+
bg-gray-50
159+
focus-visible:outline-none
160+
focus:ring-4
161+
focus:ring-gray-200
162+
dark:bg-gray-700
163+
dark:border-gray-600
164+
dark:placeholder-gray-400
165+
dark:text-white
166+
dark:focus:ring-slate-700
167+
"
168168
placeholder={t('collection.sidebar.searchAll')}
169169
onKeyDown={handleKeyDown}
170170
onBlur={handleBlur}
@@ -185,14 +185,15 @@ const CollectionSearch = ({
185185
rounded-md
186186
bg-white
187187
text-base
188-
shadow-lg
188+
shadow-md
189189
ring-1
190190
ring-black
191191
ring-opacity-5
192192
focus:outline-none
193193
sm:text-sm
194194
z-40
195195
dark:bg-slate-700
196+
dark:shadow-lg
196197
"
197198
>
198199
<div

packages/core/src/components/collections/FilterControl.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const FilterControl = ({
5252
/>
5353
<label
5454
htmlFor={labelId}
55-
className="ml-2 text-sm font-medium text-gray-900 dark:text-gray-300"
55+
className="ml-2 text-sm font-medium text-gray-800 dark:text-gray-300"
5656
>
5757
{viewFilter.label}
5858
</label>

packages/core/src/components/collections/entries/EntryListingCardGrid.tsx

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,6 @@ const EntryListingCardGrid: FC<EntryListingCardGridProps> = ({
106106
}, []);
107107

108108
const getDefaultHeight = useCallback((data?: CollectionEntryData) => {
109-
console.log(
110-
'DEFAULT HEIGHT',
111-
data,
112-
isNotNullish(data?.imageFieldName)
113-
? COLLECTION_CARD_HEIGHT
114-
: COLLECTION_CARD_HEIGHT_WITHOUT_IMAGE,
115-
);
116109
return isNotNullish(data?.imageFieldName)
117110
? COLLECTION_CARD_HEIGHT
118111
: COLLECTION_CARD_HEIGHT_WITHOUT_IMAGE;
@@ -187,22 +180,13 @@ const EntryListingCardGrid: FC<EntryListingCardGridProps> = ({
187180

188181
if (cardHeights[i] > rowHeight && cardHeights[i]) {
189182
rowHeight = cardHeights[i] + COLLECTION_CARD_MARGIN;
190-
191-
console.log(
192-
'HEIGHT @index',
193-
i,
194-
cardHeights[i],
195-
cardHeights[i] + COLLECTION_CARD_MARGIN,
196-
);
197183
}
198184
}
199185

200186
if (rowHeight === 0) {
201187
rowHeight = getDefaultHeight() + COLLECTION_CARD_MARGIN;
202188
}
203189

204-
console.log('HEIGHT', index, rowHeight);
205-
206190
return rowHeight;
207191
}}
208192
width={width}

packages/core/src/components/collections/entries/EntryListingTable.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,12 @@ const EntryListingTable: FC<EntryListingTableProps> = ({
7777
overflow-hidden
7878
p-1.5
7979
bg-white
80+
shadow-sm
81+
border
82+
border-gray-100
8083
dark:bg-slate-800
84+
dark:border-gray-700/40
85+
dark:shadow-md
8186
rounded-xl
8287
"
8388
>

packages/core/src/components/common/autocomplete/Autocomplete.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const Autocomplete = function <T>(
7070
min-h-8
7171
p-0
7272
w-full
73-
text-gray-900
73+
text-gray-800
7474
dark:text-gray-100
7575
"
7676
data-testid="autocomplete-input-wrapper"
@@ -99,7 +99,7 @@ const Autocomplete = function <T>(
9999
dark:text-gray-500
100100
`
101101
: `
102-
text-gray-900
102+
text-gray-800
103103
dark:text-gray-100
104104
`,
105105
)}
@@ -144,18 +144,19 @@ const Autocomplete = function <T>(
144144
bg-white
145145
py-1
146146
text-base
147-
shadow-lg
147+
shadow-md
148148
ring-1
149149
ring-black
150150
ring-opacity-5
151151
focus:outline-none
152152
sm:text-sm
153153
z-30
154154
dark:bg-slate-700
155+
dark:shadow-lg
155156
`}
156157
>
157158
{options.length === 0 ? (
158-
<div className="relative cursor-default select-none py-2 px-4 text-gray-700">
159+
<div className="relative cursor-default select-none py-2 px-4 text-gray-800">
159160
Nothing found.
160161
</div>
161162
) : (
@@ -179,7 +180,7 @@ const Autocomplete = function <T>(
179180
pl-10
180181
pr-4
181182
cursor-pointer
182-
text-gray-900
183+
text-gray-800
183184
dark:text-gray-100
184185
`,
185186
(selected || active) &&

packages/core/src/components/common/card/Card.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ const Card = ({ children, className }: CardProps) => {
1414
<div
1515
className={classNames(
1616
`
17-
bg-white border
18-
border-gray-200
17+
bg-white
18+
border
19+
border-gray-100
1920
rounded-lg
20-
shadow-md
21+
shadow-sm
2122
dark:bg-slate-800
2223
dark:border-gray-700/40
24+
dark:shadow-md
2325
flex
2426
flex-col
2527
h-full

packages/core/src/components/common/card/CardContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ interface CardContentProps {
77
}
88

99
const CardContent = ({ children }: CardContentProps) => {
10-
return <p className="w-full p-5 font-normal text-gray-700 dark:text-gray-300">{children}</p>;
10+
return <p className="w-full p-5 font-normal text-gray-800 dark:text-gray-300">{children}</p>;
1111
};
1212

1313
export default CardContent;

packages/core/src/components/common/card/CardHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ interface CardHeaderProps {
88

99
const CardHeader = ({ children }: CardHeaderProps) => {
1010
return (
11-
<h5 className="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">
11+
<h5 className="mb-2 text-2xl font-bold tracking-tight text-gray-800 dark:text-white">
1212
{children}
1313
</h5>
1414
);

packages/core/src/components/common/menu/Menu.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,15 @@ const Menu = ({
9797
rounded-md
9898
bg-white
9999
dark:bg-slate-800
100-
shadow-lg
100+
shadow-md
101101
border
102102
border-gray-200
103103
focus:outline-none
104104
divide-y
105105
divide-gray-100
106106
dark:border-gray-700
107107
dark:divide-gray-600
108+
dark:shadow-lg
108109
`,
109110
onClick: handleClose,
110111
},

packages/core/src/components/common/menu/MenuItemButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ const MenuItemButton = ({
4646
items-center
4747
justify-between
4848
cursor-pointer
49-
dark:disabled:text-gray-700
49+
dark:disabled:text-gray-800
5050
`,
5151
color === 'default' &&
5252
`
53-
text-gray-700
53+
text-gray-800
5454
dark:text-gray-300
5555
hover:bg-gray-200
5656
dark:hover:bg-slate-600

packages/core/src/components/common/menu/MenuItemLink.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const MenuItemLink = ({
3636
px-4
3737
py-2
3838
text-sm
39-
text-gray-700
39+
text-gray-800
4040
dark:text-gray-300
4141
w-full
4242
text-left

packages/core/src/components/common/pill/Pill.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const Pill: FC<PillProps> = ({
4545
`
4646
: `
4747
bg-gray-200
48-
text-gray-900
48+
text-gray-800
4949
dark:bg-gray-700
5050
dark:text-gray-100
5151
`;

packages/core/src/components/common/select/Option.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const Option = function <T>({
4040
py-2
4141
px-4
4242
cursor-pointer
43-
text-gray-900
43+
text-gray-800
4444
hover:bg-blue-500
4545
dark:text-gray-100
4646
`,

packages/core/src/components/common/select/Select.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ const Select = forwardRef(
136136
px-4
137137
py-1.5
138138
w-full
139-
text-gray-900
139+
text-gray-800
140140
dark:text-gray-100
141141
`,
142142
disabled &&
@@ -154,14 +154,15 @@ const Select = forwardRef(
154154
bg-white
155155
py-1
156156
text-base
157-
shadow-lg
157+
shadow-md
158158
ring-1
159159
ring-black
160160
ring-opacity-5
161161
focus:outline-none
162162
sm:text-sm
163163
z-50
164164
dark:bg-slate-700
165+
dark:shadow-lg
165166
`,
166167
style: { width },
167168
disablePortal: false,

packages/core/src/components/common/switch/Switch.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const Switch = forwardRef<HTMLInputElement | null, SwitchProps>(
8686
ml-3
8787
text-sm
8888
font-medium
89-
text-gray-900
89+
text-gray-800
9090
dark:text-gray-300
9191
"
9292
>

packages/core/src/components/common/table/Table.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@ const TableCell = ({ columns, children }: TableCellProps) => {
1313
return (
1414
<div
1515
className="
16-
shadow-md
1716
z-[2]
1817
"
1918
>
2019
<table className="w-full text-sm text-left text-gray-500 dark:text-gray-300">
2120
<thead className="text-xs">
22-
<tr>
21+
<tr className="shadow-sm">
2322
{columns.map((column, index) => (
2423
<TableHeaderCell key={index}>{column}</TableHeaderCell>
2524
))}

packages/core/src/components/common/table/TableCell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const TableCell = ({ children, emphasis = false, to, shrink = false }: TableCell
4242
text-gray-500
4343
dark:text-gray-300
4444
`,
45-
emphasis && 'font-medium text-gray-900 whitespace-nowrap dark:text-white',
45+
emphasis && 'font-medium text-gray-800 whitespace-nowrap dark:text-white',
4646
shrink && 'w-0',
4747
)}
4848
>

packages/core/src/components/common/table/TableHeaderCell.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,13 @@ const TableHeaderCell = ({ children }: TableHeaderCellProps) => {
2727
className="
2828
px-4
2929
py-3
30-
text-gray-900
30+
text-gray-800
3131
border-gray-100
3232
border-b
3333
bg-white
3434
dark:text-white
3535
dark:border-gray-700
3636
dark:bg-slate-800
37-
shadow-sm
3837
text-[14px]
3938
"
4039
>

packages/core/src/components/common/text-field/TextArea.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const TextArea = forwardRef<HTMLInputElement | null, TextAreaProps>(
7575
outline-none
7676
text-sm
7777
font-medium
78-
text-gray-900
78+
text-gray-800
7979
dark:text-gray-100
8080
disabled:text-gray-300
8181
dark:disabled:text-gray-500

0 commit comments

Comments
 (0)