Soul fixes: a folder that empties keeps its Back row, blank titles get a label
All checks were successful
Build pull request / Build pull request (pull_request) Successful in 4m1s
All checks were successful
Build pull request / Build pull request (pull_request) Successful in 4m1s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
53a724ae27
commit
b8eed50bd7
3 changed files with 7 additions and 3 deletions
|
|
@ -131,7 +131,7 @@ export function AlbumView({ room, onTimeline }: AlbumViewProps) {
|
|||
);
|
||||
} else if (encrypted)
|
||||
body = <Text>This zone is encrypted, so its albums cannot be listed here.</Text>;
|
||||
else if (albums.length === 0) body = <Text>No albums yet.</Text>;
|
||||
else if (albums.length === 0 && path.length === 0) body = <Text>No albums yet.</Text>;
|
||||
else {
|
||||
const here = listFolder(albums, path);
|
||||
body = (
|
||||
|
|
|
|||
|
|
@ -69,6 +69,10 @@ describe('listFolder', () => {
|
|||
const odd = [album('$u', '///')];
|
||||
expect(names(listFolder(odd, []))).toEqual({ folders: [], albums: ['$u=///'] });
|
||||
expect(names(listFolder(odd, ['x']))).toEqual({ folders: [], albums: [] });
|
||||
expect(names(listFolder([album('$w', ' ')], []))).toEqual({
|
||||
folders: [],
|
||||
albums: ['$w=Untitled album'],
|
||||
});
|
||||
});
|
||||
|
||||
it('server-supplied names like "constructor" are folders, not prototype hits', () => {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Pure: folders are albums whose title is a `/`-separated path (docs/commons-files-desk.md, "Folders").
|
||||
// No wire change: the album is still one thread root; the folder tree is only how the list is grouped.
|
||||
import { Album } from './buildAlbums';
|
||||
import { Album, UNTITLED } from './buildAlbums';
|
||||
|
||||
/** A path as segments. Empty segments and surrounding space drop out; `.` and `..` are ordinary names, never navigation. */
|
||||
export const splitPath = (title: string): string[] =>
|
||||
|
|
@ -36,7 +36,7 @@ export const listFolder = (albums: readonly Album[], at: string[]): FolderListin
|
|||
const segs = splitPath(album.title);
|
||||
if (segs.length === 0) {
|
||||
// An untitled or all-slash title lives at the root under the title as written.
|
||||
if (at.length === 0) direct.push({ album, leaf: album.title });
|
||||
if (at.length === 0) direct.push({ album, leaf: album.title.trim() || UNTITLED });
|
||||
return;
|
||||
}
|
||||
if (!startsWith(segs, at)) return;
|
||||
|
|
|
|||
Loading…
Reference in a new issue