Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

feat(navigation): unify creator and space browsing scopes (#6378)

boojack26be2a9663fd
diff --git a/filter/engine_test.go b/filter/engine_test.go
index e7ffe1c85..a7b27a0e6 100644
--- a/filter/engine_test.go
+++ b/filter/engine_test.go
@@ -109,6 +109,19 @@ func TestRenderSpaceFilters(t *testing.T) {
}
}
+func TestRenderAttachmentCreatorFilter(t *testing.T) {
+ t.Parallel()
+
+ engine, err := NewEngine(NewAttachmentSchema())
+ require.NoError(t, err)
+ for _, dialect := range []DialectName{DialectSQLite, DialectMySQL, DialectPostgres} {
+ statement, err := engine.CompileToStatement(context.Background(), `creator == "users/alice"`, RenderOptions{Dialect: dialect})
+ require.NoError(t, err, dialect)
+ require.Contains(t, statement.SQL, "CASE WHEN", dialect)
+ require.Equal(t, []any{"users/alice"}, statement.Args, dialect)
+ }
+}
+
func TestCompileContainsEscapesLikeWildcards(t *testing.T) {
t.Parallel()
diff --git a/filter/schema.go b/filter/schema.go
index 5e4a7b652..9ead7b256 100644
--- a/filter/schema.go
+++ b/filter/schema.go
@@ -288,6 +288,20 @@ func NewSchema() Schema {
// NewAttachmentSchema constructs the attachment filter schema and CEL environment.
func NewAttachmentSchema() Schema {
fields := map[string]Field{
+ "creator": {
+ Name: "creator",
+ Kind: FieldKindScalar,
+ Type: FieldTypeString,
+ Column: Column{Table: "memo", Name: "creator_id"},
+ Expressions: map[DialectName]string{
+ DialectSQLite: "('users/' || (SELECT username FROM user WHERE id = CASE WHEN attachment.memo_id IS NULL THEN attachment.creator_id ELSE %[1]s END))",
+ DialectMySQL: "CONCAT('users/', (SELECT username FROM `user` WHERE id = CASE WHEN `attachment`.`memo_id` IS NULL THEN `attachment`.`creator_id` ELSE %[1]s END))",
+ DialectPostgres: "('users/' || (SELECT username FROM \"user\" WHERE id = CASE WHEN attachment.memo_id IS NULL THEN attachment.creator_id ELSE %[1]s END))",
+ },
+ AllowedComparisonOps: map[ComparisonOperator]bool{
+ CompareEq: true,
+ },
+ },
"filename": {
Name: "filename",
Kind: FieldKindScalar,
@@ -345,6 +359,7 @@ func NewAttachmentSchema() Schema {
}
envOptions := []cel.EnvOption{
+ cel.Variable("creator", cel.StringType),
cel.Variable("filename", cel.StringType),
cel.Variable("mime_type", cel.StringType),
cel.Variable("create_time", cel.TimestampType),
diff --git a/proto/api/v1/attachment_service.proto b/proto/api/v1/attachment_service.proto
index 884b6cacd..c5a0a879f 100644
--- a/proto/api/v1/attachment_service.proto
+++ b/proto/api/v1/attachment_service.proto
@@ -31,7 +31,7 @@ service AttachmentService {
body: "*"
};
}
- // ListAttachments lists all attachments.
+ // ListAttachments lists attachments linked to readable memos and the caller's unlinked uploads.
rpc ListAttachments(ListAttachmentsRequest) returns (ListAttachmentsResponse) {
option (google.api.http) = {get: "/api/v1/attachments"};
}
@@ -177,6 +177,13 @@ message Attachment {
(google.api.field_behavior) = OPTIONAL,
(google.api.field_behavior) = IMMUTABLE
];
+
+ // Output only. The user who uploaded this attachment, which may differ from
+ // the creator of the linked memo. Format: users/{user}.
+ string creator = 11 [
+ (google.api.field_behavior) = OUTPUT_ONLY,
+ (google.api.resource_reference) = {type: "memos.api.v1/User"}
+ ];
}
message CreateAttachmentRequest {
@@ -258,7 +265,9 @@ message ListAttachmentsRequest {
// Optional. Filter to apply to the list results.
// Example: "mime_type==\"image/png\"" or "filename.contains(\"test\")"
// Supported operators: =, !=, <, <=, >, >=, : (contains), in
- // Supported fields: filename, mime_type, create_time, memo_id, space.
+ // Supported fields: creator, filename, mime_type, create_time, memo_id, space.
+ // `creator` is the linked memo's creator, or the uploader for an unlinked
+ // attachment. It supports equality with a User resource name.
// `space` only supports a non-negated `==` comparison with a Space resource
// name or null.
// `space` is the linked memo's space resource name, or null when the
diff --git a/proto/gen/api/v1/apiv1connect/attachment_service.connect.go b/proto/gen/api/v1/apiv1connect/attachment_service.connect.go
index 5424a1420..a49a235af 100644
--- a/proto/gen/api/v1/apiv1connect/attachment_service.connect.go
+++ b/proto/gen/api/v1/apiv1connect/attachment_service.connect.go
@@ -66,7 +66,7 @@ type AttachmentServiceClient interface {
// Uploads are bound to the authenticated user, expire after 30 minutes of
// inactivity, and do not survive a server restart.
UploadAttachment(context.Context, *connect.Request[v1.UploadAttachmentRequest]) (*connect.Response[v1.UploadAttachmentResponse], error)
- // ListAttachments lists all attachments.
+ // ListAttachments lists attachments linked to readable memos and the caller's unlinked uploads.
ListAttachments(context.Context, *connect.Request[v1.ListAttachmentsRequest]) (*connect.Response[v1.ListAttachmentsResponse], error)
// GetAttachment returns an attachment by name.
GetAttachment(context.Context, *connect.Request[v1.GetAttachmentRequest]) (*connect.Response[v1.Attachment], error)
@@ -189,7 +189,7 @@ type AttachmentServiceHandler interface {
// Uploads are bound to the authenticated user, expire after 30 minutes of
// inactivity, and do not survive a server restart.
UploadAttachment(context.Context, *connect.Request[v1.UploadAttachmentRequest]) (*connect.Response[v1.UploadAttachmentResponse], error)
- // ListAttachments lists all attachments.
+ // ListAttachments lists attachments linked to readable memos and the caller's unlinked uploads.
ListAttachments(context.Context, *connect.Request[v1.ListAttachmentsRequest]) (*connect.Response[v1.ListAttachmentsResponse], error)
// GetAttachment returns an attachment by name.
GetAttachment(context.Context, *connect.Request[v1.GetAttachmentRequest]) (*connect.Response[v1.Attachment], error)
diff --git a/proto/gen/api/v1/attachment_service.pb.go b/proto/gen/api/v1/attachment_service.pb.go
index 9eeba093b..9c703c26a 100644
--- a/proto/gen/api/v1/attachment_service.pb.go
+++ b/proto/gen/api/v1/attachment_service.pb.go
@@ -610,6 +610,9 @@ type Attachment struct {
MotionMedia *MotionMedia `protobuf:"bytes,9,opt,name=motion_media,json=motionMedia,proto3" json:"motion_media,omitempty"`
// Optional. Immutable normalized media metadata explicitly supplied by the client at creation time.
MediaMetadata *MediaMetadata `protobuf:"bytes,10,opt,name=media_metadata,json=mediaMetadata,proto3" json:"media_metadata,omitempty"`
+ // Output only. The user who uploaded this attachment, which may differ from
+ // the creator of the linked memo. Format: users/{user}.
+ Creator string `protobuf:"bytes,11,opt,name=creator,proto3" json:"creator,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -714,6 +717,13 @@ func (x *Attachment) GetMediaMetadata() *MediaMetadata {
return nil
}
+func (x *Attachment) GetCreator() string {
+ if x != nil {
+ return x.Creator
+ }
+ return ""
+}
+
type CreateAttachmentRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
// Required. The attachment to create.
@@ -1041,7 +1051,9 @@ type ListAttachmentsRequest struct {
// Optional. Filter to apply to the list results.
// Example: "mime_type==\"image/png\"" or "filename.contains(\"test\")"
// Supported operators: =, !=, <, <=, >, >=, : (contains), in
- // Supported fields: filename, mime_type, create_time, memo_id, space.
+ // Supported fields: creator, filename, mime_type, create_time, memo_id, space.
+ // `creator` is the linked memo's creator, or the uploader for an unlinked
+ // attachment. It supports equality with a User resource name.
// `space` only supports a non-negated `==` comparison with a Space resource
// name or null.
// `space` is the linked memo's space resource name, or null when the
@@ -1410,7 +1422,7 @@ const file_api_v1_attachment_service_proto_rawDesc = "" +
"\x10_altitude_meters\"T\n" +
"\rVideoMetadata\x12.\n" +
"\x10duration_seconds\x18\x01 \x01(\x01H\x00R\x0fdurationSeconds\x88\x01\x01B\x13\n" +
- "\x11_duration_seconds\"\x8a\x04\n" +
+ "\x11_duration_seconds\"\xbf\x04\n" +
"\n" +
"Attachment\x12\x17\n" +
"\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12@\n" +
@@ -1424,7 +1436,9 @@ const file_api_v1_attachment_service_proto_rawDesc = "" +
"\x04memo\x18\b \x01(\tB\x03\xe0A\x01H\x00R\x04memo\x88\x01\x01\x12A\n" +
"\fmotion_media\x18\t \x01(\v2\x19.memos.api.v1.MotionMediaB\x03\xe0A\x01R\vmotionMedia\x12J\n" +
"\x0emedia_metadata\x18\n" +
- " \x01(\v2\x1b.memos.api.v1.MediaMetadataB\x06\xe0A\x01\xe0A\x05R\rmediaMetadata:O\xeaAL\n" +
+ " \x01(\v2\x1b.memos.api.v1.MediaMetadataB\x06\xe0A\x01\xe0A\x05R\rmediaMetadata\x123\n" +
+ "\acreator\x18\v \x01(\tB\x19\xe0A\x03\xfaA\x13\n" +
+ "\x11memos.api.v1/UserR\acreator:O\xeaAL\n" +
"\x17memos.api.v1/Attachment\x12\x18attachments/{attachment}*\vattachments2\n" +
"attachmentB\a\n" +
"\x05_memo\"\x82\x01\n" +
diff --git a/proto/gen/api/v1/attachment_service_grpc.pb.go b/proto/gen/api/v1/attachment_service_grpc.pb.go
index 69d15b0ad..41ba8a44c 100644
--- a/proto/gen/api/v1/attachment_service_grpc.pb.go
+++ b/proto/gen/api/v1/attachment_service_grpc.pb.go
@@ -40,7 +40,7 @@ type AttachmentServiceClient interface {
// Uploads are bound to the authenticated user, expire after 30 minutes of
// inactivity, and do not survive a server restart.
UploadAttachment(ctx context.Context, in *UploadAttachmentRequest, opts ...grpc.CallOption) (*UploadAttachmentResponse, error)
- // ListAttachments lists all attachments.
+ // ListAttachments lists attachments linked to readable memos and the caller's unlinked uploads.
ListAttachments(ctx context.Context, in *ListAttachmentsRequest, opts ...grpc.CallOption) (*ListAttachmentsResponse, error)
// GetAttachment returns an attachment by name.
GetAttachment(ctx context.Context, in *GetAttachmentRequest, opts ...grpc.CallOption) (*Attachment, error)
@@ -141,7 +141,7 @@ type AttachmentServiceServer interface {
// Uploads are bound to the authenticated user, expire after 30 minutes of
// inactivity, and do not survive a server restart.
UploadAttachment(context.Context, *UploadAttachmentRequest) (*UploadAttachmentResponse, error)
- // ListAttachments lists all attachments.
+ // ListAttachments lists attachments linked to readable memos and the caller's unlinked uploads.
ListAttachments(context.Context, *ListAttachmentsRequest) (*ListAttachmentsResponse, error)
// GetAttachment returns an attachment by name.
GetAttachment(context.Context, *GetAttachmentRequest) (*Attachment, error)
diff --git a/proto/gen/openapi.yaml b/proto/gen/openapi.yaml
index 6a135b469..6828e9e22 100644
--- a/proto/gen/openapi.yaml
+++ b/proto/gen/openapi.yaml
@@ -35,7 +35,7 @@ paths:
get:
tags:
- AttachmentService
- description: ListAttachments lists all attachments.
+ description: ListAttachments lists attachments linked to readable memos and the caller's unlinked uploads.
operationId: AttachmentService_ListAttachments
parameters:
- name: pageSize
@@ -61,7 +61,9 @@ paths:
Optional. Filter to apply to the list results.
Example: "mime_type==\"image/png\"" or "filename.contains(\"test\")"
Supported operators: =, !=, <, <=, >, >=, : (contains), in
- Supported fields: filename, mime_type, create_time, memo_id, space.
+ Supported fields: creator, filename, mime_type, create_time, memo_id, space.
+ `creator` is the linked memo's creator, or the uploader for an unlinked
+ attachment. It supports equality with a User resource name.
`space` only supports a non-negated `==` comparison with a Space resource
name or null.
`space` is the linked memo's space resource name, or null when the
@@ -3066,6 +3068,12 @@ components:
allOf:
- $ref: '#/components/schemas/MediaMetadata'
description: Optional. Immutable normalized media metadata explicitly supplied by the client at creation time.
+ creator:
+ readOnly: true
+ type: string
+ description: |-
+ Output only. The user who uploaded this attachment, which may differ from
+ the creator of the linked memo. Format: users/{user}.
BatchDeleteAttachmentsRequest:
required:
- names
diff --git a/server/api/v1/attachment_service.go b/server/api/v1/attachment_service.go
index 2e317f52c..e8ebeccf3 100644
--- a/server/api/v1/attachment_service.go
+++ b/server/api/v1/attachment_service.go
@@ -115,10 +115,11 @@ func (s *APIV1Service) prepareAttachment(ctx context.Context, request *v1pb.Crea
}
create := &store.Attachment{
- UID: attachmentUID,
- CreatorID: user.ID,
- Filename: request.Attachment.Filename,
- Type: request.Attachment.Type,
+ UID: attachmentUID,
+ CreatorID: user.ID,
+ CreatorUsername: &user.Username,
+ Filename: request.Attachment.Filename,
+ Type: request.Attachment.Type,
}
inputMotionMedia, err := validateClientMotionMedia(request.Attachment.MotionMedia, attachmentUID)
@@ -310,10 +311,9 @@ func (s *APIV1Service) ListAttachments(ctx context.Context, request *v1pb.ListAt
}
findAttachment := &store.FindAttachment{
- CreatorID: &user.ID,
- Access: newMemoAccessScope(user, true),
- Limit: &pageSize,
- Offset: &offset,
+ Access: newMemoAccessScope(user, true),
+ Limit: &pageSize,
+ Offset: &offset,
}
// Parse filter if provided
if request.Filter != "" {
diff --git a/server/api/v1/attachment_service_storage.go b/server/api/v1/attachment_service_storage.go
index cdd60c324..f8567c13b 100644
--- a/server/api/v1/attachment_service_storage.go
+++ b/server/api/v1/attachment_service_storage.go
@@ -32,6 +32,9 @@ func convertAttachmentFromStore(attachment *store.Attachment) *v1pb.Attachment {
MotionMedia: convertMotionMediaFromStore(getAttachmentMotionMedia(attachment)),
MediaMetadata: convertMediaMetadataFromStore(attachment.Payload.GetMediaMetadata()),
}
+ if attachment.CreatorUsername != nil {
+ attachmentMessage.Creator = BuildUserName(*attachment.CreatorUsername)
+ }
if attachment.MemoUID != nil && *attachment.MemoUID != "" {
memoName := fmt.Sprintf("%s%s", MemoNamePrefix, *attachment.MemoUID)
attachmentMessage.Memo = &memoName
diff --git a/server/api/v1/test/attachment_service_test.go b/server/api/v1/test/attachment_service_test.go
index f9f238aa4..f97254a37 100644
--- a/server/api/v1/test/attachment_service_test.go
+++ b/server/api/v1/test/attachment_service_test.go
@@ -39,6 +39,7 @@ func TestCreateAttachment(t *testing.T) {
})
require.NoError(t, err)
require.Equal(t, "image/png", attachment.Type)
+ require.Equal(t, apiv1.BuildUserName(user.Username), attachment.Creator)
})
// Test case 2: Create attachment with empty type and unknown extension, but detectable content
@@ -525,6 +526,10 @@ func TestListAttachmentsSpaceFilter(t *testing.T) {
UID: "attachment-api-space-a", CreatorID: owner.ID, Content: "a", Visibility: store.Private, SpaceID: &spaceA.ID,
})
require.NoError(t, err)
+ sharedMemo, err := ts.Store.CreateMemo(ctx, &store.Memo{
+ UID: "attachment-api-space-a-shared", CreatorID: owner.ID, Content: "shared", Visibility: store.SpaceAudience, SpaceID: &spaceA.ID,
+ })
+ require.NoError(t, err)
spaceBMemo, err := ts.Store.CreateMemo(ctx, &store.Memo{
UID: "attachment-api-space-b", CreatorID: owner.ID, Content: "b", Visibility: store.Public, SpaceID: &spaceB.ID,
})
@@ -540,6 +545,7 @@ func TestListAttachmentsSpaceFilter(t *testing.T) {
createAttachment("attachment-api-unlinked", nil)
createAttachment("attachment-api-unassigned-file", &unassignedMemo.ID)
createAttachment("attachment-api-space-a-file", &spaceAMemo.ID)
+ createAttachment("attachment-api-space-a-shared-file", &sharedMemo.ID)
createAttachment("attachment-api-space-b-file", &spaceBMemo.ID)
attachmentFilenames := func(response *v1pb.ListAttachmentsResponse) []string {
@@ -553,14 +559,14 @@ func TestListAttachmentsSpaceFilter(t *testing.T) {
ownerCtx := ts.CreateUserContext(ctx, owner.ID)
allResponse, err := ts.Service.ListAttachments(ownerCtx, &v1pb.ListAttachmentsRequest{PageSize: 100})
require.NoError(t, err)
- require.Len(t, allResponse.Attachments, 4, "omitting the filter must preserve the creator's full readable library")
+ require.Len(t, allResponse.Attachments, 5, "omitting the filter includes every readable attachment and the owner's unused uploads")
spaceResponse, err := ts.Service.ListAttachments(ownerCtx, &v1pb.ListAttachmentsRequest{
PageSize: 100,
Filter: `space == "spaces/` + spaceA.UID + `"`,
})
require.NoError(t, err)
- require.Equal(t, []string{"attachment-api-space-a-file.txt"}, attachmentFilenames(spaceResponse))
+ require.ElementsMatch(t, []string{"attachment-api-space-a-file.txt", "attachment-api-space-a-shared-file.txt"}, attachmentFilenames(spaceResponse))
unassignedResponse, err := ts.Service.ListAttachments(ownerCtx, &v1pb.ListAttachmentsRequest{
PageSize: 100,
@@ -587,7 +593,14 @@ func TestListAttachmentsSpaceFilter(t *testing.T) {
Filter: `space == "spaces/` + spaceA.UID + `"`,
})
require.NoError(t, err)
- require.Empty(t, memberResponse.Attachments, "the attachment library remains creator-owned")
+ require.Equal(t, []string{"attachment-api-space-a-shared-file.txt"}, attachmentFilenames(memberResponse))
+
+ creatorResponse, err := ts.Service.ListAttachments(ts.CreateUserContext(ctx, member.ID), &v1pb.ListAttachmentsRequest{
+ PageSize: 100,
+ Filter: `creator == "users/` + owner.Username + `"`,
+ })
+ require.NoError(t, err)
+ require.ElementsMatch(t, []string{"attachment-api-space-a-shared-file.txt", "attachment-api-space-b-file.txt"}, attachmentFilenames(creatorResponse))
_, err = ts.Service.ListAttachments(ts.CreateUserContext(ctx, outsider.ID), &v1pb.ListAttachmentsRequest{
Filter: `space == "spaces/` + spaceA.UID + `"`,
@@ -600,6 +613,37 @@ func TestListAttachmentsSpaceFilter(t *testing.T) {
require.Equal(t, codes.InvalidArgument, status.Code(err))
}
+func TestAttachmentCreatorIsUploader(t *testing.T) {
+ ctx := context.Background()
+ ts := NewTestService(t)
+ defer ts.Cleanup()
+
+ memoAuthor, err := ts.CreateRegularUser(ctx, "attachment-memo-author")
+ require.NoError(t, err)
+ uploader, err := ts.CreateRegularUser(ctx, "attachment-uploader")
+ require.NoError(t, err)
+ memo, err := ts.Store.CreateMemo(ctx, &store.Memo{
+ UID: "attachment-attribution-memo", CreatorID: memoAuthor.ID, Content: "shared", Visibility: store.Public,
+ })
+ require.NoError(t, err)
+ _, err = ts.Store.CreateAttachment(ctx, &store.Attachment{
+ UID: "attachment-attribution-file", CreatorID: uploader.ID, Filename: "shared.txt", Type: "text/plain", MemoID: &memo.ID,
+ })
+ require.NoError(t, err)
+
+ authorCtx := ts.CreateUserContext(ctx, memoAuthor.ID)
+ listed, err := ts.Service.ListAttachments(authorCtx, &v1pb.ListAttachmentsRequest{
+ Filter: `creator == "users/` + memoAuthor.Username + `"`,
+ })
+ require.NoError(t, err)
+ require.Len(t, listed.Attachments, 1)
+ require.Equal(t, apiv1.BuildUserName(uploader.Username), listed.Attachments[0].Creator)
+
+ got, err := ts.Service.GetAttachment(authorCtx, &v1pb.GetAttachmentRequest{Name: listed.Attachments[0].Name})
+ require.NoError(t, err)
+ require.Equal(t, apiv1.BuildUserName(uploader.Username), got.Creator)
+}
+
func memoIDFromName(ctx context.Context, t *testing.T, ts *TestService, name string) int32 {
t.Helper()
memoUID, err := apiv1.ExtractMemoUIDFromName(name)
diff --git a/store/attachment.go b/store/attachment.go
index 0d801ca6b..271a9dca4 100644
--- a/store/attachment.go
+++ b/store/attachment.go
@@ -40,7 +40,8 @@ type Attachment struct {
Policy *MemoWritePolicy
// Composed field
- MemoUID *string
+ MemoUID *string
+ CreatorUsername *string
}
type FindAttachment struct {
diff --git a/store/db/mysql/attachment.go b/store/db/mysql/attachment.go
index d917f810b..ff121371a 100644
--- a/store/db/mysql/attachment.go
+++ b/store/db/mysql/attachment.go
@@ -144,6 +144,7 @@ func (d *DB) ListAttachments(ctx context.Context, find *store.FindAttachment) ([
"`attachment`.`reference` AS `reference`",
"`attachment`.`payload` AS `payload`",
"CASE WHEN `memo`.`uid` IS NOT NULL THEN `memo`.`uid` ELSE NULL END AS `memo_uid`",
+ "`attachment_creator`.`username` AS `creator_username`",
}
if find.GetBlob {
fields = append(fields, "`attachment`.`blob` AS `blob`")
@@ -151,6 +152,7 @@ func (d *DB) ListAttachments(ctx context.Context, find *store.FindAttachment) ([
query := "SELECT " + strings.Join(fields, ", ") + " FROM `attachment`" + " " +
"LEFT JOIN `memo` ON `attachment`.`memo_id` = `memo`.`id`" + " " +
+ "LEFT JOIN `user` AS `attachment_creator` ON `attachment`.`creator_id` = `attachment_creator`.`id`" + " " +
"LEFT JOIN `space` AS `attachment_space` ON `memo`.`space_id` = `attachment_space`.`id`" + " " +
"WHERE " + strings.Join(where, " AND ") + " " +
"ORDER BY `updated_ts` DESC"
@@ -187,6 +189,7 @@ func (d *DB) ListAttachments(ctx context.Context, find *store.FindAttachment) ([
&attachment.Reference,
&payloadBytes,
&attachment.MemoUID,
+ &attachment.CreatorUsername,
}
if find.GetBlob {
dests = append(dests, &attachment.Blob)
diff --git a/store/db/postgres/attachment.go b/store/db/postgres/attachment.go
index 191d37ccb..2869e28f4 100644
--- a/store/db/postgres/attachment.go
+++ b/store/db/postgres/attachment.go
@@ -138,6 +138,7 @@ func (d *DB) ListAttachments(ctx context.Context, find *store.FindAttachment) ([
"attachment.reference AS reference",
"attachment.payload AS payload",
"CASE WHEN memo.uid IS NOT NULL THEN memo.uid ELSE NULL END AS memo_uid",
+ "attachment_creator.username AS creator_username",
}
if find.GetBlob {
fields = append(fields, "attachment.blob AS blob")
@@ -148,6 +149,7 @@ func (d *DB) ListAttachments(ctx context.Context, find *store.FindAttachment) ([
%s
FROM attachment
LEFT JOIN memo ON attachment.memo_id = memo.id
+ LEFT JOIN "user" AS attachment_creator ON attachment.creator_id = attachment_creator.id
LEFT JOIN space AS attachment_space ON memo.space_id = attachment_space.id
WHERE %s
ORDER BY attachment.updated_ts DESC
@@ -185,6 +187,7 @@ func (d *DB) ListAttachments(ctx context.Context, find *store.FindAttachment) ([
&attachment.Reference,
&payloadBytes,
&attachment.MemoUID,
+ &attachment.CreatorUsername,
}
if find.GetBlob {
dests = append(dests, &attachment.Blob)
diff --git a/store/db/sqlite/attachment.go b/store/db/sqlite/attachment.go
index 7a7838166..231ababe4 100644
--- a/store/db/sqlite/attachment.go
+++ b/store/db/sqlite/attachment.go
@@ -135,6 +135,7 @@ func (d *DB) ListAttachments(ctx context.Context, find *store.FindAttachment) ([
"`attachment`.`reference` AS `reference`",
"`attachment`.`payload` AS `payload`",
"CASE WHEN `memo`.`uid` IS NOT NULL THEN `memo`.`uid` ELSE NULL END AS `memo_uid`",
+ "`attachment_creator`.`username` AS `creator_username`",
}
if find.GetBlob {
fields = append(fields, "`attachment`.`blob` AS `blob`")
@@ -142,6 +143,7 @@ func (d *DB) ListAttachments(ctx context.Context, find *store.FindAttachment) ([
query := "SELECT " + strings.Join(fields, ", ") + " FROM `attachment`" + " " +
"LEFT JOIN `memo` ON `attachment`.`memo_id` = `memo`.`id`" + " " +
+ "LEFT JOIN `user` AS `attachment_creator` ON `attachment`.`creator_id` = `attachment_creator`.`id`" + " " +
"LEFT JOIN `space` AS `attachment_space` ON `memo`.`space_id` = `attachment_space`.`id`" + " " +
"WHERE " + strings.Join(where, " AND ") + " " +
"ORDER BY `attachment`.`updated_ts` DESC"
@@ -178,6 +180,7 @@ func (d *DB) ListAttachments(ctx context.Context, find *store.FindAttachment) ([
&attachment.Reference,
&payloadBytes,
&attachment.MemoUID,
+ &attachment.CreatorUsername,
}
if find.GetBlob {
dests = append(dests, &attachment.Blob)
diff --git a/store/test/attachment_access_test.go b/store/test/attachment_access_test.go
index f482d0e3a..0576b2ef4 100644
--- a/store/test/attachment_access_test.go
+++ b/store/test/attachment_access_test.go
@@ -127,6 +127,40 @@ func TestAttachmentSpaceFilterFiltersByMemoPlacement(t *testing.T) {
require.ElementsMatch(t, []int32{unlinked.ID, unassigned.ID}, attachmentIDs(unassignedAttachments))
}
+func TestAttachmentCreatorFilterUsesMemoAuthor(t *testing.T) {
+ ctx := context.Background()
+ ts := NewTestingStore(ctx, t)
+ defer ts.Close()
+
+ uploader, err := ts.CreateUser(ctx, &store.User{Username: "attachment-uploader", Role: store.RoleUser, PasswordHash: "hash"})
+ require.NoError(t, err)
+ author, err := ts.CreateUser(ctx, &store.User{Username: "attachment-memo-author", Role: store.RoleUser, PasswordHash: "hash"})
+ require.NoError(t, err)
+ memo, err := ts.CreateMemo(ctx, &store.Memo{
+ UID: "attachment-creator-memo", CreatorID: author.ID, Content: "public memo", Visibility: store.Public,
+ })
+ require.NoError(t, err)
+ linked, err := ts.CreateAttachment(ctx, &store.Attachment{
+ UID: "attachment-creator-linked", CreatorID: uploader.ID, Filename: "linked.txt", Type: "text/plain", MemoID: &memo.ID,
+ })
+ require.NoError(t, err)
+ unlinked, err := ts.CreateAttachment(ctx, &store.Attachment{
+ UID: "attachment-creator-unlinked", CreatorID: uploader.ID, Filename: "unlinked.txt", Type: "text/plain",
+ })
+ require.NoError(t, err)
+
+ access := &store.MemoAccessScope{UserID: &uploader.ID, AllowPublic: true, AllowProtected: true}
+ list := func(filter string) []*store.Attachment {
+ attachments, listErr := ts.ListAttachments(ctx, &store.FindAttachment{
+ Access: access, Filters: []string{filter}, SkipDefaultLimit: true,
+ })
+ require.NoError(t, listErr)
+ return attachments
+ }
+ require.Equal(t, []int32{linked.ID}, attachmentIDs(list(`creator == "users/attachment-memo-author"`)))
+ require.Equal(t, []int32{unlinked.ID}, attachmentIDs(list(`creator == "users/attachment-uploader"`)))
+}
+
func TestAttachmentAccessScopeUsesDirectMemoAudience(t *testing.T) {
ctx := context.Background()
ts := NewTestingStore(ctx, t)
diff --git a/web/src/App.tsx b/web/src/App.tsx
index 58af79329..e5ea7de98 100644
--- a/web/src/App.tsx
+++ b/web/src/App.tsx
@@ -2,6 +2,7 @@ import { DirectionProvider } from "@base-ui/react/direction-provider";
import { useEffect } from "react";
import { Outlet, ScrollRestoration } from "react-router-dom";
import { useInstance } from "./contexts/InstanceContext";
+import { TimelineViewProvider } from "./contexts/ViewContext";
import useNavigateTo from "./hooks/useNavigateTo";
import { useUserLocale } from "./hooks/useUserLocale";
import { useUserTheme } from "./hooks/useUserTheme";
@@ -60,7 +61,9 @@ const App = () => {
return (
<DirectionProvider direction={direction}>
- <Outlet />
+ <TimelineViewProvider>
+ <Outlet />
+ </TimelineViewProvider>
<ScrollRestoration />
</DirectionProvider>
);
diff --git a/web/src/components/AppSidebar/AppSidebar.tsx b/web/src/components/AppSidebar/AppSidebar.tsx
index 7831287c0..77f76439e 100644
--- a/web/src/components/AppSidebar/AppSidebar.tsx
+++ b/web/src/components/AppSidebar/AppSidebar.tsx
@@ -4,14 +4,11 @@ import {
ArrowRightIcon,
BellIcon,
CalendarDaysIcon,
- ChevronDownIcon,
- EarthIcon,
FileAudioIcon,
FileTextIcon,
- HouseIcon,
ImageIcon,
InfoIcon,
- LayoutListIcon,
+ LibraryIcon,
ListIcon,
type LucideIcon,
MapIcon,
@@ -22,37 +19,31 @@ import {
Trash2Icon,
UserRoundIcon,
} from "lucide-react";
-import { type ReactNode, useEffect } from "react";
-import { Link, matchPath, useLocation, useNavigate } from "react-router-dom";
+import { useRef } from "react";
+import { Link, matchPath, useLocation } from "react-router-dom";
import { MAP_MEMO_FILTER } from "@/components/MapView/useMapMemos";
import { MemoDetailSidebar } from "@/components/MemoDetailSidebar";
+import MemoDisplaySettingMenu from "@/components/MemoDisplaySettingMenu";
import { DEFAULT_SETTING_SECTION, SETTINGS_SECTIONS } from "@/components/Settings/settingSections";
import StatisticsView from "@/components/StatisticsView";
-import UserMenu from "@/components/UserMenu";
import { Button } from "@/components/ui/button";
-import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
import { Sheet, SheetContent, SheetTitle } from "@/components/ui/sheet";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
import { type AttachmentSection, type InboxFilter, useAppSidebar } from "@/contexts/AppSidebarContext";
import { useAuth } from "@/contexts/AuthContext";
import { useGlobalMemoEditor } from "@/contexts/GlobalMemoEditorContext";
import { useInstance } from "@/contexts/InstanceContext";
-import { getFilterSearch, useMemoFilterContext } from "@/contexts/MemoFilterContext";
import { useSpaceContext } from "@/contexts/SpaceContext";
import { useAttachmentLibraryStats } from "@/hooks/useAttachmentLibrary";
import useCurrentUser from "@/hooks/useCurrentUser";
-import { type MemoStatsContext, useFilteredMemoStats } from "@/hooks/useFilteredMemoStats";
+import { useFilteredMemoStats } from "@/hooks/useFilteredMemoStats";
import useMediaQuery from "@/hooks/useMediaQuery";
-import { useNotifications, useUser } from "@/hooks/useUserQueries";
+import { useNotifications } from "@/hooks/useUserQueries";
import { combineCELFilters } from "@/lib/cel-filter";
-import { getMemoScopePath, getProfileUsername, type PrimaryMemoScope, resolveMemoScope } from "@/lib/memo-views";
-import { userNamePrefix } from "@/lib/resource-names";
import { cn } from "@/lib/utils";
-import { collectionPathForLocation, ROUTES } from "@/router/routes";
-import { State } from "@/types/proto/api/v1/common_pb";
+import { collectionNavigationPath, ROUTES, resolveCollectionRoute } from "@/router/routes";
import { User_Role, UserNotification_Status } from "@/types/proto/api/v1/user_service_pb";
import { useTranslate } from "@/utils/i18n";
-import MemosLogo from "../MemosLogo";
import CommonSidebarContent from "./CommonSidebarContent";
import { getSidebarRouteKind } from "./routes";
import SidebarRow, { SIDEBAR_ROW_CLASSES, SIDEBAR_ROW_FOCUS_CLASSES, SidebarRowIconSlot, sidebarRowStateClasses } from "./SidebarRow";
@@ -81,59 +72,38 @@ const NewMemoAction = ({ onClick }: { onClick: () => void }) => {
);
};
-const ProfileNavigation = () => {
- const t = useTranslate();
- const { setMobileOpen } = useAppSidebar();
-
- return (
- <SidebarSection label={t("common.profile")}>
- <SidebarRow state="current" icon={LayoutListIcon} label={t("common.memos")} onClick={() => setMobileOpen(false)} />
- </SidebarSection>
- );
-};
-
/** The calendar is its own month view, so its sidebar narrows by view and tag but skips the heatmap. */
const CollectionSidebarContent = ({
context,
showStatistics = true,
scopeFilter,
}: {
- context: MemoStatsContext;
+ context: "home" | "explore" | "archived";
showStatistics?: boolean;
/** A page that can only show part of the collection counts that part, so a tag never promises memos the page cannot show. */
scopeFilter?: string;
}) => {
const t = useTranslate();
- const location = useLocation();
const currentUser = useCurrentUser();
- const { memoFilter, selectedSpaceName } = useSpaceContext();
+ const { memoFilter, selectedSpaceName, creatorUsername } = useSpaceContext();
const md = useMediaQuery("md");
const { mobileOpen, setMobileOpen } = useAppSidebar();
const { isInitialized: authInitialized } = useAuth();
const { isInitialized: instanceInitialized } = useInstance();
- const profileUsername = getProfileUsername(location.pathname);
- const { data: profileUser } = useUser(`${userNamePrefix}${profileUsername ?? ""}`, {
- enabled: context === "profile" && profileUsername !== undefined,
- });
- const statsUserName = context === "home" ? currentUser?.name : context === "profile" ? profileUser?.name : undefined;
// User-level collections stay aligned with their unscoped feeds even when a Space is remembered.
- const isUserLevelCollection = context === "profile" || context === "archived";
+ const isUserLevelCollection = context === "archived";
const collectionFilter = isUserLevelCollection ? undefined : memoFilter;
const statsFilter = scopeFilter ? combineCELFilters(collectionFilter, scopeFilter) : collectionFilter;
const { statistics, tags } = useFilteredMemoStats({
- context,
- userName: statsUserName,
+ context: context === "archived" ? "archived" : "collection",
filter: statsFilter,
enabled: authInitialized && instanceInitialized && (md || mobileOpen),
});
- const tagStateScope = isUserLevelCollection
- ? (statsUserName ?? context)
- : `${statsUserName ?? context}${selectedSpaceName ? `:${selectedSpaceName}` : ""}`;
+ const tagStateScope = isUserLevelCollection ? context : `${creatorUsername ?? "all"}${selectedSpaceName ? `:${selectedSpaceName}` : ""}`;
return (
<div className={SIDEBAR_SECTION_STACK_CLASSES}>
- {context === "profile" && <ProfileNavigation />}
{showStatistics && (
<SidebarSection ariaLabel={t("common.statistics")}>
<StatisticsView statisticsData={statistics} onDateSelect={() => setMobileOpen(false)} />
@@ -148,7 +118,8 @@ const CollectionSidebarContent = ({
const AttachmentsSidebarContent = () => {
const t = useTranslate();
- const { memoFilter, selectedSpaceName } = useSpaceContext();
+ const currentUser = useCurrentUser();
+ const { memoFilter, selectedSpaceName, creatorUsername } = useSpaceContext();
const { attachmentSection, setAttachmentSection, setMobileOpen } = useAppSidebar();
const { isComplete, stats } = useAttachmentLibraryStats(memoFilter);
const total = stats.media + stats.documents + stats.audio;
@@ -164,7 +135,7 @@ const AttachmentsSidebarContent = () => {
},
];
// Unlinked uploads do not belong to any Space, so "Unused" is only a Memos-level collection.
- if (!selectedSpaceName) {
+ if (!selectedSpaceName && (!creatorUsername || creatorUsername === currentUser?.username)) {
rows.push({
value: "unused",
icon: Trash2Icon,
@@ -284,7 +255,7 @@ const MemoDetailSidebarContent = () => {
const RouteSidebarContent = () => {
const location = useLocation();
const kind = getSidebarRouteKind(location.pathname);
- if (kind === "home" || kind === "archived" || kind === "explore" || kind === "profile") {
+ if (kind === "home" || kind === "archived" || kind === "explore") {
return <CollectionSidebarContent context={kind} />;
}
if (kind === "views") return <ViewsSection manageActive />;
@@ -304,7 +275,6 @@ interface GlobalNavItem {
path: string;
icon: LucideIcon;
active: boolean;
- count?: number;
}
/**
@@ -313,102 +283,67 @@ interface GlobalNavItem {
* header's compose control. Expanding the label only opens the text track, so the
* artwork and surface never jump.
*
- * The label is a luxury the row affords by width, never by truncation. Five squares and
- * their gaps cost 148px and the longest label 82px more, so below a 230px row (the default
- * sidebar's content box) the current page stays a filled square with its tooltip.
+ * Actions are separated by 4px; icons and labels by 6px. Below a 230px row the current
+ * page stays a filled square with its tooltip, leaving room for the other actions.
+ * Timeline's trailing arrow shares its surface, with a separate click target.
*/
-const NAV_LABEL_QUERY = "@min-[230px]:";
const navPillClasses = (active: boolean) =>
cn(sidebarSurfaceVariants({ role: "navPill" }), SIDEBAR_ROW_FOCUS_CLASSES, sidebarRowStateClasses(active ? "current" : "idle"));
-const NavPillLabel = ({ expanded, label, children }: { expanded: boolean; label: ReactNode; children?: ReactNode }) => (
+const NavPillLabel = ({ expanded, label }: { expanded: boolean; label: string }) => (
// The control carries its own aria-label; this text is decoration whether or not it is open.
<span
aria-hidden="true"
className={cn(
"grid min-w-0 grid-cols-[0fr] ps-0 transition-[grid-template-columns,padding] duration-200 ease-out motion-reduce:transition-none",
- expanded && `${NAV_LABEL_QUERY}grid-cols-[1fr] ${NAV_LABEL_QUERY}ps-2`,
+ expanded && "@min-[230px]:grid-cols-[1fr] @min-[230px]:ps-1.5",
)}
>
- <span className="flex min-w-0 items-center gap-1.5 overflow-hidden">
- <span data-sidebar-label className="shrink-0 truncate text-[12px]">
+ <span className="flex min-w-0 items-center overflow-hidden">
+ <span data-sidebar-label className="shrink-0 truncate text-[12px] leading-5">
{label}
</span>
- {children}
</span>
</span>
);
const GlobalNavigation = () => {
const t = useTranslate();
+ const timelineRef = useRef<HTMLDivElement>(null);
const location = useLocation();
- const navigate = useNavigate();
const currentUser = useCurrentUser();
- const { memoDetail, memoScope, setMemoScope, setMobileOpen, setQuickFindOpen } = useAppSidebar();
- const { filters } = useMemoFilterContext();
+ const { setMobileOpen, setQuickFindOpen } = useAppSidebar();
const routeKind = getSidebarRouteKind(location.pathname);
- const resolvedScope = resolveMemoScope(location.pathname, {
- currentUsername: currentUser?.username,
- detailFrom: memoDetail?.from,
- memoArchived: memoDetail?.memo.state === State.ARCHIVED,
- fallback: memoScope,
- });
- const primaryScope: PrimaryMemoScope = resolvedScope === "archived" ? memoScope : resolvedScope;
- const routeOwnsPrimaryScope =
- resolvedScope !== "archived" && (routeKind === "home" || routeKind === "explore" || routeKind === "profile" || routeKind === "memo");
- const scopeRouteActive = routeKind === "home" || routeKind === "explore";
-
- useEffect(() => {
- if (routeOwnsPrimaryScope && primaryScope !== memoScope) {
- setMemoScope(primaryScope);
- }
- }, [memoScope, primaryScope, routeOwnsPrimaryScope, setMemoScope]);
-
- const scopeItems: Array<{ id: PrimaryMemoScope; label: string; icon: LucideIcon }> = [
- { id: "home", label: t("common.home"), icon: HouseIcon },
- { id: "explore", label: t("common.explore"), icon: EarthIcon },
- ];
- const activeScopeItem = scopeItems.find((item) => item.id === primaryScope) ?? scopeItems[0];
- const ActiveScopeIcon = activeScopeItem.icon;
-
- const navigateToScope = (scope: PrimaryMemoScope) => {
- setMemoScope(scope);
- navigate({ pathname: collectionPathForLocation(getMemoScopePath(scope), location.pathname), search: getFilterSearch(filters) });
- setMobileOpen(false);
- };
-
+ const homeActive = routeKind === "home" || routeKind === "explore";
+ const homePath =
+ !currentUser && !resolveCollectionRoute(location.pathname).isCollection
+ ? ROUTES.EXPLORE
+ : collectionNavigationPath(ROUTES.HOME, location, currentUser?.username);
const items: GlobalNavItem[] = currentUser
? [
{
id: "calendar",
label: t("common.calendar"),
- path: collectionPathForLocation(ROUTES.CALENDAR, location.pathname),
+ path: collectionNavigationPath(ROUTES.CALENDAR, location, currentUser.username),
icon: CalendarDaysIcon,
active: routeKind === "calendar",
},
{
id: "map",
label: t("common.map"),
- path: collectionPathForLocation(ROUTES.MAP, location.pathname),
+ path: collectionNavigationPath(ROUTES.MAP, location, currentUser.username),
icon: MapIcon,
active: routeKind === "map",
},
{
id: "attachments",
label: t("common.attachments"),
- path: collectionPathForLocation(ROUTES.ATTACHMENTS, location.pathname),
+ path: collectionNavigationPath(ROUTES.ATTACHMENTS, location, currentUser.username),
icon: PaperclipIcon,
active: routeKind === "attachments",
},
]
: [
- {
- id: "explore",
- label: t("common.explore"),
- path: ROUTES.EXPLORE,
- icon: EarthIcon,
- active: routeKind === "explore" || routeKind === "profile" || routeKind === "memo",
- },
{
id: "about",
label: t("common.about"),
@@ -417,82 +352,36 @@ const GlobalNavigation = () => {
active: Boolean(matchPath(ROUTES.ABOUT, location.pathname)),
},
];
-
- // Keep exactly one textual anchor in the compact horizontal navigator. The active
- // destination expands; routes outside this navigator fall back to its first control
- // without incorrectly marking that fallback as the current page.
- const activeNavigatorItemId = currentUser && scopeRouteActive ? "scope" : items.find((item) => item.active)?.id;
- const expandedNavigatorItemId = activeNavigatorItemId ?? (currentUser ? "scope" : items[0]?.id);
- const scopeExpanded = expandedNavigatorItemId === "scope";
-
- const scopeMenuContent = (
- <DropdownMenuContent align="start" sideOffset={4} className="flex w-36 flex-col gap-0.5">
- {scopeItems.map((item) => {
- const Icon = item.icon;
- return (
- <DropdownMenuItem
- key={item.id}
- aria-current={item.id === resolvedScope ? "page" : undefined}
- className={cn("h-8 shrink-0 py-0 text-[13px]", item.id === resolvedScope && "bg-accent font-medium text-accent-foreground")}
- onClick={() => navigateToScope(item.id)}
- >
- <Icon className="size-4" strokeWidth={1.8} />
- <span className="truncate">{item.label}</span>
- </DropdownMenuItem>
- );
- })}
- </DropdownMenuContent>
- );
+ const expandedItemId = homeActive ? "home" : (items.find((item) => item.active)?.id ?? "home");
return (
<TooltipProvider>
- <nav className={cn("@container flex h-7 items-center gap-0.5", SIDEBAR_RAIL_CLASSES)} aria-label="Primary">
- {currentUser && (
- <DropdownMenu
- onOpenChange={(open, eventDetails) => {
- // Off the scope routes this is a navigation control, not a menu trigger.
- if (open && !scopeRouteActive) {
- eventDetails.cancel();
- navigateToScope(primaryScope);
+ <nav className={cn("@container flex h-7 items-center gap-1", SIDEBAR_RAIL_CLASSES)} aria-label="Primary">
+ <div ref={timelineRef} className={cn("flex shrink-0 items-center rounded-md", homeActive && sidebarRowStateClasses("current"))}>
+ <Tooltip disabled={expandedItemId === "home"}>
+ <TooltipTrigger
+ render={
+ <Link
+ to={homePath}
+ onClick={() => setMobileOpen(false)}
+ aria-label={t("common.timeline")}
+ aria-current={homeActive ? "page" : undefined}
+ className={cn(navPillClasses(homeActive), homeActive && "rounded-e-none pe-0")}
+ />
}
- }}
- >
- <Tooltip disabled={scopeExpanded}>
- {/* Keep the tooltip wrapper separate: Base UI otherwise propagates its
- disabled state to the nested dropdown trigger. */}
- <TooltipTrigger render={<span className="flex min-w-0" />}>
- <DropdownMenuTrigger
- render={
- <button
- type="button"
- aria-label={activeScopeItem.label}
- aria-current={scopeRouteActive ? "page" : undefined}
- className={cn("group/scope", navPillClasses(scopeRouteActive))}
- />
- }
- >
- <span className={SIDEBAR_NAV_LEADING_SLOT_CLASSES} aria-hidden="true">
- <ActiveScopeIcon className="size-4 opacity-75" strokeWidth={1.8} />
- </span>
- <NavPillLabel expanded={scopeExpanded} label={activeScopeItem.label}>
- {scopeRouteActive && (
- <ChevronDownIcon
- data-sidebar-trailing
- className="size-3 shrink-0 opacity-55 transition-transform duration-200 ease-out group-data-[popup-open]/scope:rotate-180 motion-reduce:transition-none"
- strokeWidth={1.8}
- />
- )}
- </NavPillLabel>
- </DropdownMenuTrigger>
- </TooltipTrigger>
- <TooltipContent side="bottom">{activeScopeItem.label}</TooltipContent>
- </Tooltip>
- {scopeMenuContent}
- </DropdownMenu>
- )}
+ >
+ <span className={SIDEBAR_NAV_LEADING_SLOT_CLASSES} aria-hidden="true">
+ <LibraryIcon className="size-4 opacity-75" strokeWidth={1.8} />
+ </span>
+ <NavPillLabel expanded={expandedItemId === "home"} label={t("common.timeline")} />
+ </TooltipTrigger>
+ <TooltipContent side="bottom">{t("common.timeline")}</TooltipContent>
+ </Tooltip>
+ {homeActive && <MemoDisplaySettingMenu anchor={timelineRef} />}
+ </div>
{items.map((item) => {
const Icon = item.icon;
- const expanded = item.id === expandedNavigatorItemId;
+ const expanded = item.id === expandedItemId;
return (
<Tooltip key={item.id} disabled={expanded}>
<TooltipTrigger
@@ -510,24 +399,11 @@ const GlobalNavigation = () => {
<Icon className="size-4 opacity-75" strokeWidth={1.8} />
</span>
<NavPillLabel expanded={expanded} label={item.label} />
- {item.count != null && (
- <span
- data-sidebar-trailing
- className={cn(
- "absolute -end-0.5 top-0 flex min-w-4 items-center justify-center rounded-full bg-primary px-1 text-[9px] font-semibold leading-4 text-primary-foreground transition-[opacity,scale] duration-200 ease-out motion-reduce:transition-none",
- item.count > 0 ? "scale-100 opacity-100" : "scale-50 opacity-0",
- )}
- >
- {item.count > 0 && (item.count > 99 ? "99+" : item.count)}
- </span>
- )}
</TooltipTrigger>
<TooltipContent side="bottom">{item.label}</TooltipContent>
</Tooltip>
);
})}
- {/* Search is a place to go, not a header action: it closes the navigator's row
- so the header keeps only the brand and the bordered compose control. */}
<Tooltip>
<TooltipTrigger
render={
@@ -553,28 +429,6 @@ const GlobalNavigation = () => {
);
};
-/** Signed-in users can navigate between Spaces from any page; global pages show Memos. */
-const SidebarBrand = ({ className, size = "md" }: { className?: string; size?: "md" | "header" }) => {
- const currentUser = useCurrentUser();
-
- if (currentUser) {
- return <SpaceSwitcher className={className} size={size} />;
- }
-
- return (
- <Link
- to={currentUser ? ROUTES.HOME : ROUTES.EXPLORE}
- className={cn(
- "transition-colors hover:bg-sidebar-accent/65 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/40",
- sidebarSurfaceVariants({ role: size === "header" ? "headerBrand" : "mobileBrand" }),
- className,
- )}
- >
- <MemosLogo compact size={size === "header" ? "header" : "md"} />
- </Link>
- );
-};
-
const AppSidebar = ({ className }: { className?: string }) => {
const t = useTranslate();
const currentUser = useCurrentUser();
@@ -583,7 +437,7 @@ const AppSidebar = ({ className }: { className?: string }) => {
return (
<aside className={cn("flex h-full w-full select-none flex-col bg-sidebar text-sidebar-foreground", className)}>
<div data-sidebar-header className={cn("flex h-13 shrink-0 items-center justify-between gap-2", SIDEBAR_RAIL_CLASSES)}>
- <SidebarBrand className="min-w-0" size="header" />
+ <SpaceSwitcher className="min-w-0" size="header" />
{canCompose && <NewMemoAction onClick={openEditor} />}
</div>
<GlobalNavigation />
@@ -591,10 +445,8 @@ const AppSidebar = ({ className }: { className?: string }) => {
<div className={cn("min-h-0 flex-1 overflow-y-auto overflow-x-hidden pt-2 pb-3 [scrollbar-width:thin]", SIDEBAR_RAIL_CLASSES)}>
<RouteSidebarContent />
</div>
- <footer className="shrink-0 border-t border-border/70">
- {currentUser ? (
- <UserMenu />
- ) : (
+ {!currentUser && (
+ <footer className="shrink-0 border-t border-border/70">
<Link
to={ROUTES.AUTH}
onClick={() => setMobileOpen(false)}
@@ -615,8 +467,8 @@ const AppSidebar = ({ className }: { className?: string }) => {
strokeWidth={1.8}
/>
</Link>
- )}
- </footer>
+ </footer>
+ )}
</aside>
);
};
@@ -628,7 +480,7 @@ export const MobileAppHeader = () => {
<Button variant="ghost" size="icon" onClick={() => setMobileOpen(true)} aria-label="Open navigation" data-mobile-navigation-trigger>
<MenuIcon className="size-[18px]" />
</Button>
- <SidebarBrand className="max-w-[12rem]" size="md" />
+ <SpaceSwitcher className="max-w-[12rem]" size="md" />
</header>
);
};
diff --git a/web/src/components/AppSidebar/QuickFindDialog.tsx b/web/src/components/AppSidebar/QuickFindDialog.tsx
index db22c3dae..0ad48adee 100644
--- a/web/src/components/AppSidebar/QuickFindDialog.tsx
+++ b/web/src/components/AppSidebar/QuickFindDialog.tsx
@@ -14,6 +14,7 @@ import { useMemoViews } from "@/hooks/useUserQueries";
import { BUILTIN_TASKS_VIEW_ID, getMemoViewId, isMemoCollectionRoute } from "@/lib/memo-views";
import { extractSpaceUidFromName, formatSpaceUidForDisplay } from "@/lib/space-display";
import { cn } from "@/lib/utils";
+import { getCollectionCreator, withCollectionCreator } from "@/router/routes";
import { useTranslate } from "@/utils/i18n";
import { getRouteActionPolicy, getSidebarRouteKind } from "./routes";
@@ -58,12 +59,15 @@ export const resolveQuickFindSubmission = (
query: string,
currentFilters: MemoFilter[],
mode: QuickFindMode,
+ search = "",
): QuickFindSubmission => {
- const routePolicy = getRouteActionPolicy(pathname);
+ const routePolicy = getRouteActionPolicy(pathname, search);
const filters = buildQuickFindFilters(query, currentFilters, routePolicy.searchScope !== "all", mode);
return {
filters,
- destination: routePolicy.searchDestination ? `${routePolicy.searchDestination}${getFilterSearch(filters)}` : undefined,
+ destination: routePolicy.searchDestination
+ ? `${routePolicy.searchDestination}${withCollectionCreator(getFilterSearch(filters), routePolicy.searchScope === "route-collection" ? getCollectionCreator(search) : undefined)}`
+ : undefined,
};
};
@@ -71,7 +75,6 @@ const getScopeLabel = (pathname: string, t: ReturnType<typeof useTranslate>) =>
const routeKind = getSidebarRouteKind(pathname);
if (routeKind === "archived") return t("common.archived");
if (routeKind === "explore") return t("common.explore");
- if (routeKind === "profile") return t("common.profile");
return t("common.memos");
};
@@ -111,7 +114,7 @@ const QuickFindDialog = () => {
}, [filters, quickFindOpen]);
const submitQuery = () => {
- const submission = resolveQuickFindSubmission(location.pathname, query, filters, mode);
+ const submission = resolveQuickFindSubmission(location.pathname, query, filters, mode, location.search);
if (submission.destination) {
setMemoView(undefined);
diff --git a/web/src/components/AppSidebar/SpaceSwitcher.tsx b/web/src/components/AppSidebar/SpaceSwitcher.tsx
index 620e11677..3a6d31a06 100644
--- a/web/src/components/AppSidebar/SpaceSwitcher.tsx
+++ b/web/src/components/AppSidebar/SpaceSwitcher.tsx
@@ -1,205 +1,271 @@
-import { CheckIcon, ChevronsUpDownIcon, LoaderCircleIcon, type LucideIcon, PlusIcon } from "lucide-react";
-import { type ReactNode, useRef, useState } from "react";
-import { Link, useLocation } from "react-router-dom";
+import {
+ ArrowLeftIcon,
+ AstroidIcon,
+ ChevronsUpDownIcon,
+ CompassIcon,
+ HouseIcon,
+ InfoIcon,
+ LoaderCircleIcon,
+ LogInIcon,
+ PlusIcon,
+} from "lucide-react";
+import { useRef, useState } from "react";
+import { Link, useLocation, useNavigate } from "react-router-dom";
import CreateSpaceDialog from "@/components/CreateSpaceDialog";
import MemosLogo from "@/components/MemosLogo";
import SpaceMark from "@/components/SpaceMark";
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuGroup,
- DropdownMenuItem,
- DropdownMenuLabel,
- DropdownMenuSeparator,
- DropdownMenuTrigger,
-} from "@/components/ui/dropdown-menu";
+import UserAvatar from "@/components/UserAvatar";
+import UserMenu, { type UserPreference, UserPreferenceDialog } from "@/components/UserMenu";
+import { Button } from "@/components/ui/button";
+import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
+import { Select, SelectContent, SelectItem, SelectTrigger } from "@/components/ui/select";
+import { useAppSidebar } from "@/contexts/AppSidebarContext";
import { useSpaceContext } from "@/contexts/SpaceContext";
-import { extractSpaceUidFromName, formatSpaceUidForDisplay } from "@/lib/space-display";
+import useCurrentUser from "@/hooks/useCurrentUser";
+import { useUser } from "@/hooks/useUserQueries";
+import { extractSpaceUidFromName } from "@/lib/space-display";
import { cn } from "@/lib/utils";
-import { getSpaceSwitchPath } from "@/router/routes";
+import { buildCollectionPath, getCreatorSwitchPath, getSpaceSwitchPath, ROUTES } from "@/router/routes";
import { useTranslate } from "@/utils/i18n";
import { sidebarSurfaceVariants } from "./sidebar-layout";
-// Icons in action and status rows sit in a glyph-width slot so every label in the menu
-// starts on the same text rail as the context rows.
-const RowIcon = ({ icon: Icon, className }: { icon: LucideIcon; className?: string }) => (
- <span className="flex size-5 shrink-0 items-center justify-center">
- <Icon className={cn("size-3.5", className)} />
- </span>
-);
-
-const ContextItem = ({ selected, to, children, ariaLabel }: { selected: boolean; to: string; children: ReactNode; ariaLabel?: string }) => (
- <DropdownMenuItem
- role="menuitemradio"
- aria-checked={selected}
- aria-label={ariaLabel}
- title={ariaLabel}
- closeOnClick
- render={
- <Link
- to={to}
- onClick={(event) => {
- if (selected && !event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey) event.preventDefault();
- }}
- />
- }
- className={cn("min-w-0", selected && "bg-accent/60")}
- >
- {children}
- {selected && <CheckIcon className="ms-auto size-3.5 shrink-0 text-primary" />}
- </DropdownMenuItem>
-);
-
function SpaceSwitcher({ className, size = "md" }: { className?: string; size?: "md" | "header" }) {
const t = useTranslate();
const location = useLocation();
- const memosPath = getSpaceSwitchPath(location);
- const { spaces, duplicateSpaceTitles, selectedSpace, selectedSpaceName, isLoadingSpaces, isSpacesError, selectSpace } = useSpaceContext();
+ const navigate = useNavigate();
+ const currentUser = useCurrentUser();
+ const { setMobileOpen } = useAppSidebar();
+ const { spaces, duplicateSpaceTitles, selectedSpace, selectedSpaceName, creatorUsername, isLoadingSpaces, isSpacesError, selectSpace } =
+ useSpaceContext();
+ const { data: otherCreator } = useUser(`users/${creatorUsername ?? ""}`, {
+ enabled: Boolean(creatorUsername && creatorUsername !== currentUser?.username),
+ });
const [createOpen, setCreateOpen] = useState(false);
+ const [open, setOpen] = useState(false);
+ const [preference, setPreference] = useState<UserPreference | null>(null);
const [menuWidth, setMenuWidth] = useState<number>();
const triggerRef = useRef<HTMLButtonElement>(null);
- const selectedSpaceIdentity = selectedSpace?.name || selectedSpaceName || "";
- const selectedSpaceUid = selectedSpaceIdentity ? extractSpaceUidFromName(selectedSpaceIdentity) : "";
- const showSelectedSpaceUid = selectedSpace ? duplicateSpaceTitles.has(selectedSpace.title) : Boolean(selectedSpaceName);
- const currentContextLabel = selectedSpaceName
- ? `${selectedSpace?.title || t("space.current")}${showSelectedSpaceUid && selectedSpaceUid ? ` (${selectedSpaceUid})` : ""}`
- : t("common.memos");
- const brandSize = size === "header" ? "header" : "md";
- const spaceMarkSize = size === "header" ? "header" : "md";
-
- const handleMenuOpenChange = (open: boolean) => {
- if (!open) return;
+ const selectedCreator = creatorUsername ? (creatorUsername === currentUser?.username ? currentUser : otherCreator) : undefined;
+ const creatorLabel = selectedCreator?.displayName || selectedCreator?.username || creatorUsername;
+ const isOtherCreator = Boolean(creatorUsername && creatorUsername !== currentUser?.username);
+ const returnPath = currentUser ? buildCollectionPath(ROUTES.HOME, selectedSpaceName) : ROUTES.EXPLORE;
+ const spaceLabel = selectedSpace?.title || (selectedSpaceName ? extractSpaceUidFromName(selectedSpaceName) : "");
+ const contextLabel = creatorUsername ? `${creatorLabel}${selectedSpaceName ? ` / ${spaceLabel}` : ""}` : spaceLabel;
+ const showBrand = !creatorUsername && !selectedSpaceName;
+ const triggerLabel = showBrand ? t("common.memos") : contextLabel;
+ const allSpacesLabel = t("space.all-spaces");
+ const navigateTo = (path: string) => {
+ setOpen(false);
+ setMobileOpen(false);
+ navigate(path);
+ };
+ const handleOpenChange = (next: boolean) => {
+ setOpen(next);
+ if (!next) return;
const trigger = triggerRef.current;
const sidebar = trigger?.closest("aside");
if (!trigger || !sidebar) return;
-
const sidebarRect = sidebar.getBoundingClientRect();
const triggerRect = trigger.getBoundingClientRect();
const inlineInset = Math.min(Math.abs(triggerRect.left - sidebarRect.left), Math.abs(sidebarRect.right - triggerRect.right));
const width = Math.floor(sidebarRect.width - inlineInset * 2);
if (width > 0) setMenuWidth(width);
};
+ const openPreference = (nextPreference: UserPreference) => {
+ setOpen(false);
+ setPreference(nextPreference);
+ };
return (
<>
- <DropdownMenu onOpenChange={handleMenuOpenChange}>
- <DropdownMenuTrigger
- render={
- <button
- ref={triggerRef}
- type="button"
- aria-label={`${t("space.switch")}: ${currentContextLabel}`}
- title={currentContextLabel}
- className={cn(
- "text-start transition-colors hover:bg-sidebar-accent/65 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/40",
- size === "header" ? sidebarSurfaceVariants({ role: "headerBrand" }) : sidebarSurfaceVariants({ role: "mobileBrand" }),
- className,
- )}
- />
- }
+ <Popover open={open} onOpenChange={handleOpenChange}>
+ <PopoverTrigger
+ ref={triggerRef}
+ aria-label={`${t("space.switch")}: ${triggerLabel}`}
+ title={triggerLabel}
+ className={cn(
+ "text-start transition-colors hover:bg-sidebar-accent/65 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/40",
+ sidebarSurfaceVariants({ role: size === "header" ? "headerBrand" : "mobileBrand" }),
+ className,
+ )}
>
- <span className={cn("flex min-w-0 items-center overflow-hidden", size === "header" ? "gap-2" : "gap-1.5")}>
- {selectedSpaceName ? (
- <>
- <SpaceMark icon={selectedSpace?.icon} size={spaceMarkSize} />
- <span data-sidebar-label className="flex min-w-0 flex-1 flex-col justify-center overflow-hidden">
- <span
- className={cn(
- "block truncate tracking-[-0.01em] text-foreground",
- size === "header" ? "text-[15px] font-semibold leading-5" : "text-[14px] font-medium leading-4",
- )}
- >
- {selectedSpace?.title || t("space.current")}
- </span>
- {size !== "header" && showSelectedSpaceUid && selectedSpaceUid ? (
- <span
- aria-hidden="true"
- title={selectedSpaceUid}
- className="block truncate font-mono text-[10px] leading-3 text-muted-foreground"
- >
- {formatSpaceUidForDisplay(selectedSpaceIdentity)}
- </span>
- ) : null}
- </span>
- </>
- ) : (
- <MemosLogo compact size={brandSize} />
- )}
- </span>
+ {showBrand ? (
+ <MemosLogo compact size={size === "header" ? "header" : "md"} />
+ ) : (
+ <span className="flex min-w-0 items-center gap-2 overflow-hidden">
+ {creatorUsername ? (
+ <UserAvatar avatarUrl={selectedCreator?.avatarUrl} name={creatorLabel} className="size-6 shrink-0 rounded-[6px]" />
+ ) : (
+ <SpaceMark icon={selectedSpace?.icon} size={size === "header" ? "header" : "md"} />
+ )}
+ <span
+ data-sidebar-label
+ className={cn(
+ "min-w-0 truncate tracking-[-0.01em]",
+ size === "header" ? "text-[15px] font-semibold leading-5" : "text-[14px] font-medium leading-4",
+ )}
+ >
+ {contextLabel}
+ </span>
+ </span>
+ )}
<ChevronsUpDownIcon
aria-hidden="true"
className={cn("shrink-0 text-muted-foreground/70", size === "header" ? "size-3" : "size-3.5")}
strokeWidth={1.8}
/>
- </DropdownMenuTrigger>
- <DropdownMenuContent
- size="sm"
+ </PopoverTrigger>
+ <PopoverContent
align="start"
+ side="bottom"
sideOffset={4}
- className="w-[min(15rem,calc(100vw-1rem))] max-w-[calc(100vw-1rem)]"
+ className="w-[min(15rem,calc(100vw-1rem))] max-h-[min(27rem,calc(100dvh-5rem))] overflow-y-auto p-0"
style={menuWidth ? { width: `${menuWidth}px` } : undefined}
>
- <DropdownMenuGroup>
- <ContextItem selected={!selectedSpaceName} to={memosPath}>
- <span className="min-w-0 flex-1">
- <MemosLogo compact size="sm" />
- </span>
- </ContextItem>
- {spaces.length > 0 && (
+ <div className="px-2 pb-1.5 pt-2">
+ {isOtherCreator ? (
+ <Link
+ to={returnPath}
+ className="flex h-8 items-center gap-2 rounded-sm px-2 text-xs font-medium hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40"
+ >
+ <ArrowLeftIcon aria-hidden="true" className="size-3.5 rtl:rotate-180" strokeWidth={1.8} />
+ {t("memo.back-to", { source: t(currentUser ? "common.home" : "common.explore") })}
+ </Link>
+ ) : (
<>
- <DropdownMenuLabel className="pb-0.5 pt-1.5 font-normal text-muted-foreground">{t("space.spaces")}</DropdownMenuLabel>
- {spaces.map((space) => {
- const uid = extractSpaceUidFromName(space.name);
- const showUid = duplicateSpaceTitles.has(space.title);
-
- return (
- <ContextItem
- key={space.name}
- selected={space.name === selectedSpaceName}
- to={getSpaceSwitchPath(location, space.name)}
- ariaLabel={showUid && uid ? `${space.title} (${uid})` : space.title}
+ <div className="mb-1.5 px-1 text-[10px] font-semibold tracking-[0.08em] text-muted-foreground uppercase">
+ {t("common.browse")}
+ </div>
+ <nav aria-label={t("common.browse")} className={cn("grid gap-0.5 rounded-md bg-muted p-0.5", currentUser && "grid-cols-2")}>
+ {currentUser && (
+ <Link
+ to={getCreatorSwitchPath(location, currentUser.username, currentUser.username)}
+ aria-current={creatorUsername ? "page" : undefined}
+ className={cn(
+ "flex h-8 min-w-0 items-center gap-1.5 rounded-sm px-1.5 text-xs font-medium hover:bg-background/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",
+ creatorUsername && "bg-background ring-1 ring-border shadow-sm hover:bg-background",
+ )}
>
- <SpaceMark icon={space.icon} size="sm" />
- <span className="min-w-0 flex-1 overflow-hidden">
- <span className="block max-w-full truncate font-medium">{space.title}</span>
- {showUid && uid ? (
- <span
- aria-hidden="true"
- title={uid}
- className="block truncate font-mono text-[10px] leading-3.5 text-muted-foreground"
- >
- {formatSpaceUidForDisplay(space.name)}
- </span>
- ) : null}
+ <span className="flex size-5 shrink-0 items-center justify-center">
+ <HouseIcon aria-hidden="true" className="size-4" strokeWidth={1.8} />
+ </span>
+ <span className="min-w-0 truncate">{t("common.home")}</span>
+ </Link>
+ )}
+ <Link
+ to={getCreatorSwitchPath(location, undefined, currentUser?.username)}
+ aria-current={!creatorUsername ? "page" : undefined}
+ className={cn(
+ "flex h-8 min-w-0 items-center gap-1.5 rounded-sm px-1.5 text-xs font-medium hover:bg-background/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",
+ !creatorUsername && "bg-background ring-1 ring-border shadow-sm hover:bg-background",
+ )}
+ >
+ <span className="flex size-5 shrink-0 items-center justify-center">
+ <CompassIcon aria-hidden="true" className="size-4" strokeWidth={1.8} />
+ </span>
+ <span className="min-w-0 truncate">{t("common.explore")}</span>
+ </Link>
+ </nav>
+ </>
+ )}
+ {currentUser && (
+ <>
+ <div className="mb-1 mt-2 flex h-6 items-center justify-between ps-0.5">
+ <span className="text-[10px] font-semibold tracking-[0.08em] text-muted-foreground uppercase">{t("space.spaces")}</span>
+ {!isOtherCreator && (
+ <Button
+ variant="ghost"
+ size="icon"
+ aria-label={t("space.create")}
+ title={t("space.create")}
+ onClick={() => {
+ setOpen(false);
+ setCreateOpen(true);
+ }}
+ className="size-6 text-muted-foreground hover:text-foreground"
+ >
+ <PlusIcon className="size-3.5" strokeWidth={1.8} />
+ </Button>
+ )}
+ </div>
+ <Select
+ value={selectedSpaceName ?? "all"}
+ onValueChange={(value) => {
+ if (value !== null) navigate(getSpaceSwitchPath(location, value === "all" ? undefined : value));
+ }}
+ >
+ <SelectTrigger aria-label={t("space.switch")} className="h-8 w-full px-2 text-xs font-medium shadow-none">
+ {selectedSpaceName ? (
+ <SpaceMark icon={selectedSpace?.icon} size="sm" />
+ ) : (
+ <AstroidIcon className="size-4 text-muted-foreground" />
+ )}
+ <span className="min-w-0 flex-1 truncate text-start">{selectedSpaceName ? spaceLabel : allSpacesLabel}</span>
+ </SelectTrigger>
+ <SelectContent className="max-h-64" align="start">
+ <SelectItem value="all">
+ <span className="flex items-center gap-2">
+ <AstroidIcon className="size-4" />
+ {allSpacesLabel}
</span>
- </ContextItem>
- );
- })}
+ </SelectItem>
+ {spaces.map((space) => {
+ const uid = extractSpaceUidFromName(space.name);
+ return (
+ <SelectItem key={space.name} value={space.name}>
+ <span className="flex items-center gap-2">
+ <SpaceMark icon={space.icon} size="sm" />
+ <span className="truncate">
+ {space.title}
+ {duplicateSpaceTitles.has(space.title) ? ` (${uid})` : ""}
+ </span>
+ </span>
+ </SelectItem>
+ );
+ })}
+ {isLoadingSpaces && (
+ <SelectItem value="loading" disabled>
+ <LoaderCircleIcon className="size-4 animate-spin" />
+ {t("space.loading")}
+ </SelectItem>
+ )}
+ {isSpacesError && spaces.length === 0 && (
+ <SelectItem value="error" disabled>
+ {t("space.load-error")}
+ </SelectItem>
+ )}
+ </SelectContent>
+ </Select>
</>
)}
- </DropdownMenuGroup>
- {/* isLoadingSpaces implies no data yet, so these only ever show on an empty list. */}
- {isLoadingSpaces && (
- <DropdownMenuItem disabled>
- <RowIcon icon={LoaderCircleIcon} className="animate-spin" />
- {t("space.loading")}
- </DropdownMenuItem>
- )}
- {isSpacesError && spaces.length === 0 && (
- <DropdownMenuItem disabled>
- <span className="size-5 shrink-0" />
- {t("space.load-error")}
- </DropdownMenuItem>
+ </div>
+ {currentUser ? (
+ <UserMenu onClose={() => setOpen(false)} onSelectPreference={openPreference} />
+ ) : (
+ <div className="border-t border-border/70 px-2 py-1">
+ <Button
+ variant="ghost"
+ className="h-8 w-full justify-start gap-2 rounded-sm px-2 text-xs font-normal"
+ onClick={() => navigateTo(ROUTES.ABOUT)}
+ >
+ <InfoIcon className="size-3.5 text-muted-foreground" />
+ {t("common.about")}
+ </Button>
+ <Button
+ variant="ghost"
+ className="h-8 w-full justify-start gap-2 rounded-sm px-2 text-xs font-normal"
+ onClick={() => navigateTo(ROUTES.AUTH)}
+ >
+ <LogInIcon className="size-3.5 text-muted-foreground" />
+ {t("common.sign-in")}
+ </Button>
+ </div>
)}
- <DropdownMenuSeparator />
- <DropdownMenuItem onClick={() => setCreateOpen(true)}>
- <RowIcon icon={PlusIcon} />
- {t("space.create")}
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
+ </PopoverContent>
+ </Popover>
<CreateSpaceDialog open={createOpen} onOpenChange={setCreateOpen} onCreated={selectSpace} />
+ {preference && <UserPreferenceDialog preference={preference} onClose={() => setPreference(null)} />}
</>
);
}
diff --git a/web/src/components/AppSidebar/ViewsSection.tsx b/web/src/components/AppSidebar/ViewsSection.tsx
index b65575c38..70b74f296 100644
--- a/web/src/components/AppSidebar/ViewsSection.tsx
+++ b/web/src/components/AppSidebar/ViewsSection.tsx
@@ -4,7 +4,6 @@ import { useState } from "react";
import toast from "react-hot-toast";
import { useLocation, useNavigate } from "react-router-dom";
import ConfirmDialog from "@/components/ConfirmDialog";
-import MemoDisplaySettingMenu from "@/components/MemoDisplaySettingMenu";
import MemoViewIcon from "@/components/MemoViewIcon";
import { Button } from "@/components/ui/button";
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
@@ -16,7 +15,7 @@ import { useMemoViews, userKeys } from "@/hooks/useUserQueries";
import { handleError } from "@/lib/error";
import { BUILTIN_TASKS_VIEW_ID, getMemoViewId, isMemoCollectionRoute } from "@/lib/memo-views";
import { cn } from "@/lib/utils";
-import { collectionPathForLocation, ROUTES } from "@/router/routes";
+import { getCollectionHomePath, ROUTES } from "@/router/routes";
import type { MemoView } from "@/types/proto/api/v1/user_service_pb";
import { useTranslate } from "@/utils/i18n";
import SidebarRow, {
@@ -49,8 +48,7 @@ const ViewsSection = ({ manageActive = false }: { manageActive?: boolean }) => {
const handleView = (viewId: string) => {
setMemoView(selectedMemoView === viewId ? undefined : viewId);
- if (!isMemoCollectionRoute(location.pathname))
- navigate({ pathname: collectionPathForLocation(ROUTES.HOME, location.pathname), search: location.search });
+ if (!isMemoCollectionRoute(location.pathname)) navigate({ pathname: getCollectionHomePath(location), search: location.search });
setMobileOpen(false);
};
@@ -78,12 +76,9 @@ const ViewsSection = ({ manageActive = false }: { manageActive?: boolean }) => {
label={t("common.views")}
action={
!manageActive && (
- <div className="flex items-center gap-0.5">
- <MemoDisplaySettingMenu />
- <Button variant="quiet" size="icon-sm" onClick={handleCreate} aria-label={t("common.create")}>
- <PlusIcon className={SIDEBAR_SECTION_ACTION_ICON_CLASSES} strokeWidth={1.8} />
- </Button>
- </div>
+ <Button variant="quiet" size="icon-sm" onClick={handleCreate} aria-label={t("common.create")}>
+ <PlusIcon className={SIDEBAR_SECTION_ACTION_ICON_CLASSES} strokeWidth={1.8} />
+ </Button>
)
}
>
diff --git a/web/src/components/AppSidebar/routes.ts b/web/src/components/AppSidebar/routes.ts
index aab64be4a..ea33bd922 100644
--- a/web/src/components/AppSidebar/routes.ts
+++ b/web/src/components/AppSidebar/routes.ts
@@ -1,20 +1,10 @@
import { matchPath } from "react-router-dom";
-import { getProfileUsername, isCalendarRoute, isMemoScopeRoute, type MemoScope, resolveMemoScope } from "@/lib/memo-views";
-import { collectionPathForLocation, ROUTES, resolveCollectionRoute } from "@/router/routes";
-
-export type SidebarRouteKind =
- | MemoScope
- | "profile"
- | "views"
- | "calendar"
- | "map"
- | "attachments"
- | "inbox"
- | "settings"
- | "memo"
- | "common";
-
-export type RouteSearchScope = "route-collection" | "user-collection" | "profile" | "all";
+import { isCalendarRoute, isMemoScopeRoute, type MemoScope, resolveMemoScope } from "@/lib/memo-views";
+import { getCollectionHomePath, ROUTES, resolveCollectionRoute } from "@/router/routes";
+
+export type SidebarRouteKind = MemoScope | "views" | "calendar" | "map" | "attachments" | "inbox" | "settings" | "memo" | "common";
+
+export type RouteSearchScope = "route-collection" | "user-collection" | "all";
export interface RouteActionPolicy {
searchScope: RouteSearchScope;
@@ -25,7 +15,6 @@ export interface RouteActionPolicy {
export const getSidebarRouteKind = (path: string): SidebarRouteKind => {
const normalizedPath = resolveCollectionRoute(path).pathname;
if (isMemoScopeRoute(normalizedPath)) return resolveMemoScope(normalizedPath);
- if (getProfileUsername(normalizedPath) !== undefined) return "profile";
if (matchPath(ROUTES.VIEWS, normalizedPath)) return "views";
if (isCalendarRoute(normalizedPath)) return "calendar";
if (matchPath(ROUTES.MAP, normalizedPath)) return "map";
@@ -40,7 +29,7 @@ export const getSidebarRouteKind = (path: string): SidebarRouteKind => {
* Keeps read/search scope explicit at route boundaries. Compose placement needs no
* policy: the URL only carries a Space on collection pages.
*/
-export const getRouteActionPolicy = (path: string): RouteActionPolicy => {
+export const getRouteActionPolicy = (path: string, search = ""): RouteActionPolicy => {
const kind = getSidebarRouteKind(path);
if (kind === "home" || kind === "explore") return { searchScope: "route-collection" };
@@ -49,13 +38,8 @@ export const getRouteActionPolicy = (path: string): RouteActionPolicy => {
// Calendar and attachments browse the route collection but are not memo lists
// themselves, so a search leaves for the same collection's Home.
if (kind === "calendar" || kind === "map" || kind === "attachments") {
- return { searchScope: "route-collection", searchDestination: collectionPathForLocation(ROUTES.HOME, path) };
- }
-
- if (kind === "profile") {
- // Keep search within the same profile.
- return { searchScope: "profile", searchDestination: path.length > 1 ? path.replace(/\/+$/, "") : path };
+ return { searchScope: "route-collection", searchDestination: getCollectionHomePath({ pathname: path, search }) };
}
- return { searchScope: "all", searchDestination: ROUTES.HOME };
+ return { searchScope: "all", searchDestination: ROUTES.EXPLORE };
};
diff --git a/web/src/components/AppSidebar/sidebar-layout.ts b/web/src/components/AppSidebar/sidebar-layout.ts
index 1363e4595..4759d461d 100644
--- a/web/src/components/AppSidebar/sidebar-layout.ts
+++ b/web/src/components/AppSidebar/sidebar-layout.ts
@@ -5,7 +5,7 @@ import { cva } from "class-variance-authority";
* visible artwork starts at 20px, and first-level labels start at 44px. The full-bleed
* footer action pads its content directly onto those same rails. Rows reserve a 20px
* artwork column. Compact navigation is a 28px square like the header's compose control,
- * so its glyph sits 2px inside the artwork rail and reaches the label rail with a 10px gap.
+ * with 6px padding around each glyph and a 6px gap before its label.
*/
export const SIDEBAR_RAIL_CLASSES = "px-3";
// Content rows reserve 20px so 16px icons and 20px marks share a stable label rail.
@@ -24,7 +24,7 @@ export const sidebarSurfaceVariants = cva("min-w-0 items-center", {
variants: {
role: {
row: "flex h-7 w-full gap-1 rounded-md px-2 text-ui",
- navPill: "relative flex h-7 rounded-md px-1.5",
+ navPill: "relative flex h-7 shrink-0 rounded-md px-1.5",
headerBrand: "flex h-9 max-w-full gap-2 rounded-md px-2",
mobileBrand: "flex h-9 max-w-full gap-1.5 rounded-md px-1",
account: "flex h-9 w-full gap-1 rounded-none px-5",
diff --git a/web/src/components/AttachmentLibrary/AttachmentFileRows.tsx b/web/src/components/AttachmentLibrary/AttachmentFileRows.tsx
index 784e910ba..fd3406a87 100644
--- a/web/src/components/AttachmentLibrary/AttachmentFileRows.tsx
+++ b/web/src/components/AttachmentLibrary/AttachmentFileRows.tsx
@@ -3,8 +3,11 @@ import AudioAttachmentItem from "@/components/MemoMetadata/Attachment/AudioAttac
import VideoPoster from "@/components/VideoPoster";
import type { AttachmentLibraryListItem } from "@/hooks/useAttachmentLibrary";
import { cn } from "@/lib/utils";
+import type { User } from "@/types/proto/api/v1/user_service_pb";
import { getAttachmentThumbnailUrl, getAttachmentType, isMotionAttachment } from "@/utils/attachment";
-import { AttachmentMetadataLine, AttachmentOpenButton, AttachmentSourceChip } from "./AttachmentLibraryPrimitives";
+import { AttachmentCreator, AttachmentMetadataLine, AttachmentOpenButton, AttachmentSourceChip } from "./AttachmentLibraryPrimitives";
+
+type AttachmentCreators = Map<string, User | undefined>;
const AttachmentThumb = ({ item, className }: { item: AttachmentLibraryListItem; className?: string }) => {
const type = getAttachmentType(item.attachment);
@@ -42,7 +45,7 @@ const AttachmentThumb = ({ item, className }: { item: AttachmentLibraryListItem;
);
};
-export const AttachmentDocumentRows = ({ items }: { items: AttachmentLibraryListItem[] }) => {
+export const AttachmentDocumentRows = ({ items, creators }: { items: AttachmentLibraryListItem[]; creators?: AttachmentCreators }) => {
return (
<div className="space-y-3">
{items.map((item) => (
@@ -60,6 +63,7 @@ export const AttachmentDocumentRows = ({ items }: { items: AttachmentLibraryList
</div>
<div className="mt-0.5 flex flex-wrap items-center gap-1.5">
<AttachmentMetadataLine className="min-w-0 max-w-full" items={[item.fileTypeLabel, item.fileSizeLabel, item.createdLabel]} />
+ <AttachmentCreator creatorName={item.attachment.creator} user={creators?.get(item.attachment.creator)} />
<AttachmentSourceChip memoName={item.memoName} />
</div>
</div>
@@ -71,7 +75,7 @@ export const AttachmentDocumentRows = ({ items }: { items: AttachmentLibraryList
);
};
-export const AttachmentAudioRows = ({ items }: { items: AttachmentLibraryListItem[] }) => {
+export const AttachmentAudioRows = ({ items, creators }: { items: AttachmentLibraryListItem[]; creators?: AttachmentCreators }) => {
return (
<div className="space-y-2.5">
{items.map((item) => (
@@ -88,6 +92,7 @@ export const AttachmentAudioRows = ({ items }: { items: AttachmentLibraryListIte
<div className="mt-2.5 flex items-center justify-between gap-2 border-t border-border/60 px-0.5 pt-2.5">
<div className="min-w-0 flex flex-wrap items-center gap-1.5">
<AttachmentMetadataLine className="min-w-0 max-w-full" items={[item.createdLabel]} />
+ <AttachmentCreator creatorName={item.attachment.creator} user={creators?.get(item.attachment.creator)} />
<AttachmentSourceChip memoName={item.memoName} />
</div>
<AttachmentOpenButton href={item.sourceUrl} />
@@ -98,7 +103,7 @@ export const AttachmentAudioRows = ({ items }: { items: AttachmentLibraryListIte
);
};
-export const AttachmentUnusedRows = ({ items }: { items: AttachmentLibraryListItem[] }) => {
+export const AttachmentUnusedRows = ({ items, creators }: { items: AttachmentLibraryListItem[]; creators?: AttachmentCreators }) => {
return (
<div className="space-y-2.5">
{items.map((item) => (
@@ -114,6 +119,7 @@ export const AttachmentUnusedRows = ({ items }: { items: AttachmentLibraryListIt
</div>
<div className="mt-0.5 flex flex-wrap items-center gap-1.5">
<AttachmentMetadataLine className="min-w-0 max-w-full" items={[item.fileTypeLabel, item.fileSizeLabel, item.createdLabel]} />
+ <AttachmentCreator creatorName={item.attachment.creator} user={creators?.get(item.attachment.creator)} />
<AttachmentSourceChip unlinkedLabelKey="attachment-library.labels.not-linked" />
</div>
</div>
diff --git a/web/src/components/AttachmentLibrary/AttachmentLibraryPrimitives.tsx b/web/src/components/AttachmentLibrary/AttachmentLibraryPrimitives.tsx
index b0015bbcd..a28ad7270 100644
--- a/web/src/components/AttachmentLibrary/AttachmentLibraryPrimitives.tsx
+++ b/web/src/components/AttachmentLibrary/AttachmentLibraryPrimitives.tsx
@@ -1,9 +1,13 @@
import { ExternalLinkIcon } from "lucide-react";
import { Link, useLocation } from "react-router-dom";
import { createMemoNavigationState } from "@/components/MemoView/navigation";
+import UserAvatar from "@/components/UserAvatar";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
+import { extractUsernameFromName } from "@/lib/resource-names";
import { cn } from "@/lib/utils";
+import { getCreatorHomePath } from "@/router/routes";
+import type { User } from "@/types/proto/api/v1/user_service_pb";
import { useTranslate } from "@/utils/i18n";
interface AttachmentMetadataLineProps {
@@ -21,6 +25,29 @@ interface AttachmentOpenButtonProps {
href: string;
}
+interface AttachmentCreatorProps {
+ creatorName?: string;
+ user?: User;
+}
+
+export const AttachmentCreator = ({ creatorName, user }: AttachmentCreatorProps) => {
+ if (!creatorName) return null;
+
+ const username = user?.username || extractUsernameFromName(creatorName);
+ const displayName = user?.displayName || username;
+
+ return (
+ <Link
+ to={getCreatorHomePath(username)}
+ className="inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-sm text-xs text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring"
+ viewTransition
+ >
+ <UserAvatar className="size-4 rounded-[4px]" avatarUrl={user?.avatarUrl} name={displayName} />
+ <span className="truncate">{displayName}</span>
+ </Link>
+ );
+};
+
export const AttachmentMetadataLine = ({ className, items }: AttachmentMetadataLineProps) => {
const visibleItems = items.filter((item): item is string => Boolean(item));
diff --git a/web/src/components/AttachmentLibrary/AttachmentMediaGrid.tsx b/web/src/components/AttachmentLibrary/AttachmentMediaGrid.tsx
index 3e6c572ab..d420f305e 100644
--- a/web/src/components/AttachmentLibrary/AttachmentMediaGrid.tsx
+++ b/web/src/components/AttachmentLibrary/AttachmentMediaGrid.tsx
@@ -4,16 +4,18 @@ import { Badge } from "@/components/ui/badge";
import VideoPoster from "@/components/VideoPoster";
import type { AttachmentLibraryMediaItem, AttachmentLibraryMonthGroup } from "@/hooks/useAttachmentLibrary";
import { cn } from "@/lib/utils";
+import type { User } from "@/types/proto/api/v1/user_service_pb";
import { useTranslate } from "@/utils/i18n";
import { formatMediaDuration } from "@/utils/media-metadata";
-import { AttachmentMetadataLine, AttachmentOpenButton, AttachmentSourceChip } from "./AttachmentLibraryPrimitives";
+import { AttachmentCreator, AttachmentMetadataLine, AttachmentOpenButton, AttachmentSourceChip } from "./AttachmentLibraryPrimitives";
interface AttachmentMediaGridProps {
groups: AttachmentLibraryMonthGroup[];
+ creators?: Map<string, User | undefined>;
onPreview: (itemId: string) => void;
}
-const AttachmentMediaCard = ({ item, onPreview }: { item: AttachmentLibraryMediaItem; onPreview: () => void }) => {
+const AttachmentMediaCard = ({ item, creator, onPreview }: { item: AttachmentLibraryMediaItem; creator?: User; onPreview: () => void }) => {
const t = useTranslate();
const videoDuration = item.attachments.map((attachment) => attachment.mediaMetadata?.details).find((details) => details?.case === "video")
?.value.durationSeconds;
@@ -74,6 +76,7 @@ const AttachmentMediaCard = ({ item, onPreview }: { item: AttachmentLibraryMedia
className="min-w-0"
items={[item.fileTypeLabel, item.createdLabel !== "—" ? item.createdLabel : undefined]}
/>
+ <AttachmentCreator creatorName={item.primaryAttachment.creator} user={creator} />
<div className="flex items-center justify-between gap-2">
<AttachmentSourceChip memoName={item.memoName} />
<AttachmentOpenButton href={item.sourceUrl} />
@@ -83,7 +86,7 @@ const AttachmentMediaCard = ({ item, onPreview }: { item: AttachmentLibraryMedia
);
};
-const AttachmentMediaGrid = ({ groups, onPreview }: AttachmentMediaGridProps) => {
+const AttachmentMediaGrid = ({ groups, creators, onPreview }: AttachmentMediaGridProps) => {
return (
<div className="flex flex-col gap-6 sm:gap-8">
{groups.map((group) => (
@@ -95,7 +98,12 @@ const AttachmentMediaGrid = ({ groups, onPreview }: AttachmentMediaGridProps) =>
<div className="grid grid-cols-2 gap-3 sm:gap-4 lg:grid-cols-3 xl:grid-cols-4">
{group.items.map((item) => (
- <AttachmentMediaCard key={item.id} item={item} onPreview={() => onPreview(item.previewItem.id)} />
+ <AttachmentMediaCard
+ key={item.id}
+ item={item}
+ creator={creators?.get(item.primaryAttachment.creator)}
+ onPreview={() => onPreview(item.previewItem.id)}
+ />
))}
</div>
</section>
diff --git a/web/src/components/CalendarView/CalendarView.tsx b/web/src/components/CalendarView/CalendarView.tsx
index 2069be903..b2aa01d1e 100644
--- a/web/src/components/CalendarView/CalendarView.tsx
+++ b/web/src/components/CalendarView/CalendarView.tsx
@@ -13,7 +13,6 @@ import useMediaQuery from "@/hooks/useMediaQuery";
import { useMemoFilters } from "@/hooks/useMemoFilters";
import { formatMonthLabel, getToday, parseLocalDate } from "@/lib/calendar-utils";
import { combineCELFilters } from "@/lib/cel-filter";
-import { buildMemoCreatorFilter } from "@/lib/resource-names";
import { isMemoBlurred } from "@/lib/tag";
import { collectionPathForLocation } from "@/router/routes";
import type { Memo } from "@/types/proto/api/v1/memo_service_pb";
@@ -35,7 +34,7 @@ export interface CalendarViewProps {
}
/**
- * The signed-in user's memos as a month, scoped like Home to the remembered collection.
+ * The readable memos in the selected creator and Space scope, shown as a month.
* Month and day both live in the URL; this component only reads them and renders.
*
* The open day has two homes. From md it is the floating memo panel at the end edge; at xl
@@ -54,23 +53,20 @@ export const CalendarView = ({ month, date }: CalendarViewProps) => {
const xl = useMediaQuery("xl");
const { userTagsSetting, isInitialized: authInitialized, isUserSettingsInitialized } = useAuth();
const { isInitialized: instanceInitialized } = useInstance();
- const { memoFilter: contextFilter } = useSpaceContext();
+ const { memoFilter: contextFilter, creatorUsername } = useSpaceContext();
// The sidebar's view and tag filters narrow the month exactly as they narrow Home. They are
// not echoed as chips here: the sidebar already shows them checked and clears them on a
// second click, and search hands off to Home, so nothing can be active without a sidebar row.
const viewFilter = useMemoFilters({ includeMemoViews: true, includePinned: false });
- // Statistics are already creator-scoped server-side, so leaving the creator out of their
- // filter shares the sidebar's cached query whenever no view or tag is active.
+ // The scope filter includes both creator and Space, and matches the sidebar statistics.
const statsFilter = useMemo(() => combineCELFilters(contextFilter, viewFilter), [contextFilter, viewFilter]);
- const memoFilter = useMemo(() => combineCELFilters(viewFilter, user && buildMemoCreatorFilter(user.name)), [viewFilter, user]);
- const monthFilter = useMemo(() => combineCELFilters(contextFilter, memoFilter), [contextFilter, memoFilter]);
+ const monthFilter = useMemo(() => combineCELFilters(contextFilter, viewFilter), [contextFilter, viewFilter]);
// Statistics draw counts before the month's memos load, and are the only signal the grid
// has for days outside the month.
const { statistics } = useFilteredMemoStats({
- context: "home",
- userName: user?.name,
+ context: "collection",
filter: statsFilter,
enabled: authInitialized && instanceInitialized,
});
@@ -110,12 +106,16 @@ export const CalendarView = ({ month, date }: CalendarViewProps) => {
memos={activeMemos}
selectionKey={activeDate}
timeDisplay="time"
- compose={{
- cacheKey: `calendar-day-editor:${activeDate}`,
- label: t("calendar.new-memo-on-day"),
- defaults: { defaultCreateTime },
- onSavingChange: setSaving,
- }}
+ compose={
+ user && (!creatorUsername || creatorUsername === user.username)
+ ? {
+ cacheKey: `calendar-day-editor:${activeDate}`,
+ label: t("calendar.new-memo-on-day"),
+ defaults: { defaultCreateTime },
+ onSavingChange: setSaving,
+ }
+ : undefined
+ }
/>
);
diff --git a/web/src/components/CalendarView/useMonthMemos.ts b/web/src/components/CalendarView/useMonthMemos.ts
index da3de07c1..b8ccdfb5f 100644
--- a/web/src/components/CalendarView/useMonthMemos.ts
+++ b/web/src/components/CalendarView/useMonthMemos.ts
@@ -9,7 +9,7 @@ import { State } from "@/types/proto/api/v1/common_pb";
import { ListMemosRequestSchema, type Memo } from "@/types/proto/api/v1/memo_service_pb";
import { type BuildCalendarMonthModelOptions, buildCalendarMonthModel } from "./dayModel";
-/** A realistic personal month fits one page; the loop below still drains any that do not. */
+/** A month usually fits one page; the loop below still drains any that do not. */
const MONTH_PAGE_SIZE = 500;
const NO_MEMOS: Memo[] = [];
diff --git a/web/src/components/Inbox/MemoCommentMessage.tsx b/web/src/components/Inbox/MemoCommentMessage.tsx
index 8928e7d95..37329c4f2 100644
--- a/web/src/components/Inbox/MemoCommentMessage.tsx
+++ b/web/src/components/Inbox/MemoCommentMessage.tsx
@@ -83,7 +83,11 @@ function MemoCommentMessage({ notification }: Props) {
<div className="flex items-start gap-3">
<div className="relative shrink-0">
- <UserAvatar className="w-10 h-10 ring-1 ring-border/40" avatarUrl={sender?.avatarUrl} />
+ <UserAvatar
+ className="w-10 h-10 ring-1 ring-border/40"
+ avatarUrl={sender?.avatarUrl}
+ name={sender?.displayName || sender?.username}
+ />
<div
className={cn(
"absolute -bottom-1 -right-1 w-5 h-5 rounded-full border-2 border-background flex items-center justify-center shadow-md transition-all",
diff --git a/web/src/components/Inbox/MemoMentionMessage.tsx b/web/src/components/Inbox/MemoMentionMessage.tsx
index e725bdd9c..bc0705ce3 100644
--- a/web/src/components/Inbox/MemoMentionMessage.tsx
+++ b/web/src/components/Inbox/MemoMentionMessage.tsx
@@ -85,7 +85,11 @@ function MemoMentionMessage({ notification }: Props) {
<div className="flex items-start gap-3">
<div className="relative shrink-0">
- <UserAvatar className="w-10 h-10 ring-1 ring-border/40" avatarUrl={sender?.avatarUrl} />
+ <UserAvatar
+ className="w-10 h-10 ring-1 ring-border/40"
+ avatarUrl={sender?.avatarUrl}
+ name={sender?.displayName || sender?.username}
+ />
<div
className={cn(
"absolute -bottom-1 -right-1 w-5 h-5 rounded-full border-2 border-background flex items-center justify-center shadow-md transition-all",
diff --git a/web/src/components/Inbox/SpaceInvitationMessage.tsx b/web/src/components/Inbox/SpaceInvitationMessage.tsx
index d42879de0..65caaa41c 100644
--- a/web/src/components/Inbox/SpaceInvitationMessage.tsx
+++ b/web/src/components/Inbox/SpaceInvitationMessage.tsx
@@ -117,7 +117,11 @@ function SpaceInvitationMessage({ notification }: Props) {
<div className="flex items-start gap-3">
<div className="relative shrink-0">
- <UserAvatar className="w-10 h-10 ring-1 ring-border/40" avatarUrl={sender?.avatarUrl} />
+ <UserAvatar
+ className="w-10 h-10 ring-1 ring-border/40"
+ avatarUrl={sender?.avatarUrl}
+ name={sender?.displayName || sender?.username}
+ />
<div
className={cn(
"absolute -bottom-1 -right-1 w-5 h-5 rounded-full border-2 border-background flex items-center justify-center shadow-md transition-all",
diff --git a/web/src/components/MapView/MapView.tsx b/web/src/components/MapView/MapView.tsx
index 0bc9966e4..2c7f7ebc2 100644
--- a/web/src/components/MapView/MapView.tsx
+++ b/web/src/components/MapView/MapView.tsx
@@ -29,7 +29,7 @@ export function MapView() {
const routeRef = useRef(location);
routeRef.current = location;
const desktop = useMediaQuery("md");
- const { selectedSpaceName } = useSpaceContext();
+ const { selectedSpaceName, creatorUsername } = useSpaceContext();
const user = useCurrentUser();
const { filters, removeFilter } = useMemoFilterContext();
const query = useMapMemos();
@@ -289,14 +289,16 @@ export function MapView() {
selectionKey={selectedKey}
emptyText={t(query.complete ? "map.no-results" : "map.loading")}
compose={
- composeLocation && {
- cacheKey: `map-editor:${user?.name}:${selectedSpaceName ?? "all"}:${locationKey(composeLocation)}`,
- label: t("map.new-here"),
- defaults: { defaultLocation: composeLocation },
- onComposingChange: setComposing,
- onSavingChange: setSaving,
- onConfirm: (name) => void afterSave(name),
- }
+ composeLocation && user && (!creatorUsername || creatorUsername === user.username)
+ ? {
+ cacheKey: `map-editor:${user?.name}:${selectedSpaceName ?? "all"}:${locationKey(composeLocation)}`,
+ label: t("map.new-here"),
+ defaults: { defaultLocation: composeLocation },
+ onComposingChange: setComposing,
+ onSavingChange: setSaving,
+ onConfirm: (name) => void afterSave(name),
+ }
+ : undefined
}
/>
</MemoPanel>
diff --git a/web/src/components/MapView/useMapMemos.ts b/web/src/components/MapView/useMapMemos.ts
index 4b3b2b977..d86c35470 100644
--- a/web/src/components/MapView/useMapMemos.ts
+++ b/web/src/components/MapView/useMapMemos.ts
@@ -6,7 +6,6 @@ import useCurrentUser from "@/hooks/useCurrentUser";
import { useMemoFilters } from "@/hooks/useMemoFilters";
import { useInfiniteMemos } from "@/hooks/useMemoQueries";
import { combineCELFilters } from "@/lib/cel-filter";
-import { buildMemoCreatorFilter } from "@/lib/resource-names";
import { State } from "@/types/proto/api/v1/common_pb";
import { mapMemos } from "./model";
@@ -19,7 +18,7 @@ export function useMapMemos() {
const { memoFilter } = useSpaceContext();
const { timeBasis } = useView();
const viewFilter = useMemoFilters({ includeMemoViews: true, includePinned: false });
- const filter = combineCELFilters(memoFilter, viewFilter, user && buildMemoCreatorFilter(user.name), MAP_MEMO_FILTER);
+ const filter = combineCELFilters(memoFilter, viewFilter, MAP_MEMO_FILTER);
const query = useInfiniteMemos(
{ filter, state: State.NORMAL, pageSize: 500, orderBy: `${timeBasis} desc, name desc` },
{ enabled: Boolean(user) && isUserSettingsInitialized },
diff --git a/web/src/components/MemoActionMenu/MemoShareImagePreview.tsx b/web/src/components/MemoActionMenu/MemoShareImagePreview.tsx
index 09913345c..64b372110 100644
--- a/web/src/components/MemoActionMenu/MemoShareImagePreview.tsx
+++ b/web/src/components/MemoActionMenu/MemoShareImagePreview.tsx
@@ -29,7 +29,7 @@ const MemoShareImagePreview = forwardRef<HTMLDivElement, { width: number }>(({ w
<div className="overflow-hidden rounded-lg border border-border/60 bg-background p-4 sm:p-5">
<div className="flex items-start gap-3">
<div className="flex min-w-0 items-center gap-2.5">
- <UserAvatar avatarUrl={preview.avatarUrl} className="h-8 w-8 rounded-xl" />
+ <UserAvatar avatarUrl={preview.avatarUrl} name={preview.displayName} className="h-8 w-8 rounded-xl" />
<div className="min-w-0">
<div className="truncate text-[13px] font-semibold text-foreground">{preview.displayName}</div>
{preview.formattedDisplayTime && <div className="truncate text-xs text-muted-foreground">{preview.formattedDisplayTime}</div>}
diff --git a/web/src/components/MemoContent/Mention.tsx b/web/src/components/MemoContent/Mention.tsx
index c3e32e647..59f6b0102 100644
--- a/web/src/components/MemoContent/Mention.tsx
+++ b/web/src/components/MemoContent/Mention.tsx
@@ -1,6 +1,7 @@
import type { Element } from "hast";
import { mentionStyles } from "@/lib/markdownStyles";
import { cn } from "@/lib/utils";
+import { getCreatorHomePath } from "@/router/routes";
interface MentionProps extends React.HTMLAttributes<HTMLSpanElement> {
node?: Element;
@@ -29,7 +30,7 @@ export const Mention: React.FC<MentionProps> = ({
return (
<a
- href={`/u/${username}`}
+ href={getCreatorHomePath(username)}
className={cn(mentionStyles.base, "hover:underline", className)}
data-mention={username}
title={`@${username}`}
diff --git a/web/src/components/MemoDetailSidebar/MemoDetailSidebar.tsx b/web/src/components/MemoDetailSidebar/MemoDetailSidebar.tsx
index cf1cc2c39..0c8c24ff7 100644
--- a/web/src/components/MemoDetailSidebar/MemoDetailSidebar.tsx
+++ b/web/src/components/MemoDetailSidebar/MemoDetailSidebar.tsx
@@ -150,8 +150,6 @@ const MemoDetailSidebar = ({
return t("common.archived");
case "attachments":
return t("common.attachments");
- case "profile":
- return t("common.profile");
case "views":
return t("common.views");
case "inbox":
diff --git a/web/src/components/MemoDisplaySettingMenu.tsx b/web/src/components/MemoDisplaySettingMenu.tsx
index ccd892de5..31ad22bc1 100644
--- a/web/src/components/MemoDisplaySettingMenu.tsx
+++ b/web/src/components/MemoDisplaySettingMenu.tsx
@@ -1,6 +1,6 @@
import { useDirection } from "@base-ui/react/direction-provider";
-import { Columns2Icon, Columns3Icon, InfinityIcon, type LucideIcon, Rows3Icon, SlidersHorizontalIcon } from "lucide-react";
-import type { ReactNode } from "react";
+import { ChevronDownIcon, Columns2Icon, Columns3Icon, InfinityIcon, type LucideIcon, Rows3Icon } from "lucide-react";
+import type { ReactNode, RefObject } from "react";
import { SIDEBAR_SECTION_ACTION_ICON_CLASSES } from "@/components/AppSidebar/SidebarSection";
import { buttonVariants } from "@/components/ui/button";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
@@ -12,7 +12,7 @@ import { useTranslate } from "@/utils/i18n";
import { Popover, PopoverContent, PopoverTrigger } from "./ui/popover";
interface Props {
- className?: string;
+ anchor?: RefObject<HTMLElement | null>;
}
interface SettingRowProps {
@@ -185,23 +185,29 @@ function MemoDisplaySettingsContent() {
);
}
-function MemoDisplaySettingMenu({ className }: Props) {
+function MemoDisplaySettingMenu({ anchor }: Props) {
const t = useTranslate();
+ const label = `${t("common.timeline")} · ${t("memo.view-options")}`;
return (
<Popover>
<Tooltip>
- <TooltipTrigger render={<span className="inline-flex" />}>
- <PopoverTrigger
- aria-label={t("memo.view-options")}
- className={cn(buttonVariants({ variant: "quiet", size: "icon-sm" }), className)}
- >
- <SlidersHorizontalIcon className={SIDEBAR_SECTION_ACTION_ICON_CLASSES} strokeWidth={1.8} />
- </PopoverTrigger>
+ <TooltipTrigger
+ render={
+ <PopoverTrigger
+ aria-label={label}
+ className={cn(
+ buttonVariants({ variant: "quiet", size: "icon-compact" }),
+ "w-auto rounded-s-none px-1.5 hover:bg-sidebar-accent data-popup-open:[&_svg]:rotate-180",
+ )}
+ />
+ }
+ >
+ <ChevronDownIcon className={cn(SIDEBAR_SECTION_ACTION_ICON_CLASSES, "transition-transform")} strokeWidth={1.8} />
</TooltipTrigger>
- <TooltipContent side="top">{t("memo.view-options")}</TooltipContent>
+ <TooltipContent side="bottom">{label}</TooltipContent>
</Tooltip>
- <PopoverContent align="end" sideOffset={6} aria-label={t("memo.view-options")} className="w-64 p-0">
+ <PopoverContent anchor={anchor} align="start" sideOffset={6} aria-label={label} className="w-64 p-0">
<MemoDisplaySettingsContent />
</PopoverContent>
</Popover>
diff --git a/web/src/components/MemoPanel/MemoPanelList.tsx b/web/src/components/MemoPanel/MemoPanelList.tsx
index b8858e87c..27314c395 100644
--- a/web/src/components/MemoPanel/MemoPanelList.tsx
+++ b/web/src/components/MemoPanel/MemoPanelList.tsx
@@ -51,7 +51,7 @@ export interface MemoPanelListProps {
export function MemoPanelList({ memos, selectionKey, timeDisplay, emptyText, compose }: MemoPanelListProps) {
const t = useTranslate();
const { isUserSettingsInitialized } = useAuth();
- const { selectedSpaceName } = useSpaceContext();
+ const { selectedSpaceName, creatorUsername } = useSpaceContext();
const { compactMode } = useView();
const [composingFor, setComposingFor] = useState<string>();
const composing = composingFor === selectionKey;
@@ -75,6 +75,7 @@ export function MemoPanelList({ memos, selectionKey, timeDisplay, emptyText, com
key={memo.name}
memo={memo}
timeDisplay={timeDisplay}
+ showCreator={!creatorUsername}
showVisibility
showPinned
showSpace={!selectedSpaceName}
diff --git a/web/src/components/MemoView/components/MemoCommentListView.tsx b/web/src/components/MemoView/components/MemoCommentListView.tsx
index 533defe42..b46df357f 100644
--- a/web/src/components/MemoView/components/MemoCommentListView.tsx
+++ b/web/src/components/MemoView/components/MemoCommentListView.tsx
@@ -61,7 +61,11 @@ const MemoCommentListView: React.FC = () => {
className={METADATA_ROW_CLASSES}
>
<span className={METADATA_ROW_SLOT_CLASSES} aria-hidden="true">
- <UserAvatar className="size-4 rounded-[4px]" avatarUrl={creator?.avatarUrl} />
+ <UserAvatar
+ className="size-4 rounded-[4px]"
+ avatarUrl={creator?.avatarUrl}
+ name={creator?.displayName || creator?.username}
+ />
</span>
<MemoPreview
className="min-w-0 flex-1"
diff --git a/web/src/components/MemoView/components/MemoHeader.tsx b/web/src/components/MemoView/components/MemoHeader.tsx
index d86e5ad75..b5e365c85 100644
--- a/web/src/components/MemoView/components/MemoHeader.tsx
+++ b/web/src/components/MemoView/components/MemoHeader.tsx
@@ -8,6 +8,7 @@ import { useNewMemo } from "@/contexts/NewMemoContext";
import useNavigateTo from "@/hooks/useNavigateTo";
import i18n from "@/i18n";
import { cn } from "@/lib/utils";
+import { getCreatorHomePath } from "@/router/routes";
import { Visibility } from "@/types/proto/api/v1/memo_service_pb";
import type { User } from "@/types/proto/api/v1/user_service_pb";
import { useTranslate } from "@/utils/i18n";
@@ -114,11 +115,11 @@ const CreatorDisplay: React.FC<{ creator: User }> = ({ creator }) => (
"flex min-w-0 shrink items-center gap-1.5 rounded-sm text-ui font-medium text-foreground transition-colors hover:text-foreground/80",
FOCUS_VISIBLE_OUTLINE_CLASSES,
)}
- to={`/u/${encodeURIComponent(creator.username)}`}
+ to={getCreatorHomePath(creator.username)}
viewTransition
>
<span className="flex size-5 shrink-0 items-center justify-center">
- <UserAvatar className="size-5 rounded-[5px]" avatarUrl={creator.avatarUrl} />
+ <UserAvatar className="size-5 rounded-[5px]" avatarUrl={creator.avatarUrl} name={creator.displayName || creator.username} />
</span>
<span className="min-w-0 truncate">{creator.displayName || creator.username}</span>
</Link>
diff --git a/web/src/components/Settings/InviteSpaceMemberDialog.tsx b/web/src/components/Settings/InviteSpaceMemberDialog.tsx
index 60ff8d5d0..4879bd25e 100644
--- a/web/src/components/Settings/InviteSpaceMemberDialog.tsx
+++ b/web/src/components/Settings/InviteSpaceMemberDialog.tsx
@@ -149,7 +149,11 @@ const InviteSpaceMemberDialog = ({ open, onOpenChange, space, viewerName, member
: "flex w-full items-center gap-3 rounded-lg border border-border px-3 py-2 text-left transition-colors hover:bg-muted/40 disabled:cursor-not-allowed disabled:opacity-60"
}
>
- <UserAvatar className="size-8 rounded-lg" avatarUrl={candidate.avatarUrl} />
+ <UserAvatar
+ className="size-8 rounded-lg"
+ avatarUrl={candidate.avatarUrl}
+ name={candidate.displayName || candidate.username}
+ />
<div className="min-w-0 flex-1">
<p className="truncate text-sm font-medium">{candidate.displayName || `@${candidate.username}`}</p>
<p className="truncate text-xs text-muted-foreground">
diff --git a/web/src/components/Settings/MemberSection.tsx b/web/src/components/Settings/MemberSection.tsx
index 2bf8b0e35..58e8d5163 100644
--- a/web/src/components/Settings/MemberSection.tsx
+++ b/web/src/components/Settings/MemberSection.tsx
@@ -123,7 +123,7 @@ const MemberSection = () => {
header: t("setting.member.member-column"),
render: (_, user: User) => (
<div className="flex min-w-[18rem] items-start gap-3">
- <UserAvatar className="h-10 w-10 shrink-0 rounded-xl" avatarUrl={user.avatarUrl} />
+ <UserAvatar className="h-10 w-10 shrink-0 rounded-xl" avatarUrl={user.avatarUrl} name={user.displayName || user.username} />
<div className="flex min-w-0 flex-1 flex-col">
<div className="flex flex-wrap items-center gap-x-2 gap-y-1">
<span
diff --git a/web/src/components/Settings/MyAccountSection.tsx b/web/src/components/Settings/MyAccountSection.tsx
index 7369774f7..b90a3c9a6 100644
--- a/web/src/components/Settings/MyAccountSection.tsx
+++ b/web/src/components/Settings/MyAccountSection.tsx
@@ -47,7 +47,7 @@ const MyAccountSection = () => {
<SettingSection title={t("setting.my-account.label")}>
<SettingGroup title={t("setting.account.title")}>
<div className="w-full flex flex-row flex-wrap justify-start items-center gap-3">
- <UserAvatar className="shrink-0 w-12 h-12" avatarUrl={user?.avatarUrl} />
+ <UserAvatar className="shrink-0 w-12 h-12" avatarUrl={user?.avatarUrl} name={user?.displayName || user?.username} />
<div className="flex-1 min-w-40 flex flex-col justify-center items-start gap-1">
<div className="w-full">
<span className="text-lg font-semibold">{user?.displayName}</span>
diff --git a/web/src/components/Settings/SpacesSection.tsx b/web/src/components/Settings/SpacesSection.tsx
index 1dde65578..8d124c1fc 100644
--- a/web/src/components/Settings/SpacesSection.tsx
+++ b/web/src/components/Settings/SpacesSection.tsx
@@ -66,7 +66,7 @@ const MemberIdentity = ({ member, user, isCurrentUser }: { member: SpaceMember;
return (
<div className="flex min-w-0 items-center gap-3">
- <UserAvatar className="size-10 rounded-xl" avatarUrl={user?.avatarUrl} />
+ <UserAvatar className="size-10 rounded-xl" avatarUrl={user?.avatarUrl} name={displayName} />
<div className="min-w-0">
<div className="flex flex-wrap items-center gap-1.5">
<p className="truncate text-sm font-medium">{displayName}</p>
@@ -84,7 +84,7 @@ const InvitationIdentity = ({ invitation, user }: { invitation: SpaceInvitation;
return (
<div className="flex min-w-0 items-center gap-3">
- <UserAvatar className="size-10 rounded-xl" avatarUrl={user?.avatarUrl} />
+ <UserAvatar className="size-10 rounded-xl" avatarUrl={user?.avatarUrl} name={displayName} />
<div className="min-w-0">
<p className="truncate text-sm font-medium">{displayName}</p>
<p className="mt-0.5 truncate text-xs text-muted-foreground">@{username}</p>
diff --git a/web/src/components/UpdateAccountDialog.tsx b/web/src/components/UpdateAccountDialog.tsx
index e886f71af..310e0166f 100644
--- a/web/src/components/UpdateAccountDialog.tsx
+++ b/web/src/components/UpdateAccountDialog.tsx
@@ -169,7 +169,7 @@ function UpdateAccountDialog({ open, onOpenChange, onSuccess }: Props) {
<div className="flex flex-row items-center gap-2">
<Label>{t("common.avatar")}</Label>
<label className="relative cursor-pointer hover:opacity-80">
- <UserAvatar className="w-10 h-10" avatarUrl={state.avatarUrl} />
+ <UserAvatar className="w-10 h-10" avatarUrl={state.avatarUrl} name={state.displayName || currentUser?.username} />
<input type="file" accept="image/*" className="absolute invisible w-full h-full inset-0" onChange={handleAvatarChanged} />
</label>
{state.avatarUrl && (
diff --git a/web/src/components/UserAvatar.tsx b/web/src/components/UserAvatar.tsx
index 1c13ac727..00bfabc38 100644
--- a/web/src/components/UserAvatar.tsx
+++ b/web/src/components/UserAvatar.tsx
@@ -1,21 +1,34 @@
+import type { CSSProperties } from "react";
import { cn } from "@/lib/utils";
interface Props {
avatarUrl?: string;
className?: string;
+ name?: string;
}
const UserAvatar = (props: Props) => {
- const { avatarUrl, className } = props;
+ const { avatarUrl, className, name } = props;
+ const title = name?.trim();
+ let hash = 0;
+ for (const character of title?.toLowerCase() ?? "") hash = (hash * 31 + (character.codePointAt(0) ?? 0)) | 0;
+ const style = title && !avatarUrl ? ({ "--avatar-hue": `${((hash >>> 0) % 12) * 30}deg` } as CSSProperties) : undefined;
+
return (
- <div className={cn(`w-8 h-8 overflow-clip rounded-xl border border-border`, className)}>
- <img
- className="w-full h-auto shadow min-w-full min-h-full object-cover"
- src={avatarUrl || "/full-logo.webp"}
- decoding="async"
- loading="lazy"
- alt=""
- />
+ <div
+ className={cn(
+ "flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-xl",
+ avatarUrl
+ ? "border border-border"
+ : title
+ ? "bg-[oklch(0.82_0.09_var(--avatar-hue))] [[data-theme=default-dark]_&]:bg-[oklch(0.42_0.09_var(--avatar-hue))]"
+ : "bg-muted",
+ className,
+ )}
+ style={style}
+ aria-hidden="true"
+ >
+ {avatarUrl && <img className="size-full object-cover" src={avatarUrl} decoding="async" loading="lazy" alt="" />}
</div>
);
};
diff --git a/web/src/components/UserMenu.tsx b/web/src/components/UserMenu.tsx
index a37d64d60..418ce5a84 100644
--- a/web/src/components/UserMenu.tsx
+++ b/web/src/components/UserMenu.tsx
@@ -2,16 +2,18 @@ import {
ArchiveIcon,
BellIcon,
CheckIcon,
+ ChevronRightIcon,
GlobeIcon,
InfoIcon,
LogOutIcon,
- MoreVerticalIcon,
PaletteIcon,
SettingsIcon,
- SquareUserIcon,
- User2Icon,
} from "lucide-react";
import { matchPath, useLocation } from "react-router-dom";
+import { LocaleSearchList } from "@/components/LocalePicker";
+import UserAvatar from "@/components/UserAvatar";
+import { Button } from "@/components/ui/button";
+import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import { useAppSidebar } from "@/contexts/AppSidebarContext";
import { useAuth } from "@/contexts/AuthContext";
import useCurrentUser from "@/hooks/useCurrentUser";
@@ -21,228 +23,178 @@ import { useNotifications, useUpdateUserGeneralSetting } from "@/hooks/useUserQu
import { cn } from "@/lib/utils";
import { Routes } from "@/router";
import { UserNotification_Status } from "@/types/proto/api/v1/user_service_pb";
-import { getLocaleWithFallback, loadLocale, useTranslate } from "@/utils/i18n";
+import { getLocaleDisplayName, getLocaleWithFallback, loadLocale, useTranslate } from "@/utils/i18n";
import { getThemeWithFallback, loadTheme, THEME_OPTIONS } from "@/utils/theme";
-import { SIDEBAR_LEADING_SLOT_CLASSES, sidebarSurfaceVariants } from "./AppSidebar/sidebar-layout";
-import { LocaleSearchList } from "./LocalePicker";
-import UserAvatar from "./UserAvatar";
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuSeparator,
- DropdownMenuSub,
- DropdownMenuSubContent,
- DropdownMenuSubTrigger,
- DropdownMenuTrigger,
-} from "./ui/dropdown-menu";
-import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip";
-interface Props {
- collapsed?: boolean;
-}
+export type UserPreference = "theme" | "language";
+
+const rowClass = "h-8 w-full justify-start gap-2 rounded-sm px-2 text-xs font-normal shadow-none hover:bg-accent";
+const iconClass = "size-3.5 shrink-0 text-muted-foreground";
-const UserMenu = (props: Props) => {
- const { collapsed } = props;
+const UserMenu = ({ onClose, onSelectPreference }: { onClose: () => void; onSelectPreference: (preference: UserPreference) => void }) => {
const t = useTranslate();
const location = useLocation();
const navigateTo = useNavigateTo();
const { setMobileOpen } = useAppSidebar();
const currentUser = useCurrentUser();
- const { userGeneralSetting, refetchSettings, logout } = useAuth();
- const { mutate: updateUserGeneralSetting } = useUpdateUserGeneralSetting(currentUser?.name);
- const { data: notifications = [] } = useNotifications();
const sseStatus = useSSEConnectionStatus();
+ const { userGeneralSetting, logout } = useAuth();
+ const { data: notifications = [] } = useNotifications();
const currentLocale = getLocaleWithFallback(userGeneralSetting?.locale);
const currentTheme = getThemeWithFallback(userGeneralSetting?.theme);
- const inboxActive = Boolean(matchPath(Routes.INBOX, location.pathname));
- const archivedActive = Boolean(matchPath(Routes.ARCHIVED, location.pathname));
+ const themeLabel = THEME_OPTIONS.find((option) => option.value === currentTheme)?.label ?? currentTheme;
const unreadCount = notifications.filter((notification) => notification.status === UserNotification_Status.UNREAD).length;
- const userLabel = currentUser?.displayName || currentUser?.username || t("common.profile");
- const triggerLabel = `${userLabel}, ${t("common.more")}${unreadCount > 0 ? `, ${unreadCount} ${t("inbox.unread")}` : ""}`;
const inboxLabel = unreadCount > 0 ? `${t("common.inbox")}, ${unreadCount} ${t("inbox.unread")}` : t("common.inbox");
+ const accountLabel = currentUser?.displayName || currentUser?.username || t("common.profile");
+ const inboxActive = Boolean(matchPath(Routes.INBOX, location.pathname));
+ const archivedActive = Boolean(matchPath(Routes.ARCHIVED, location.pathname));
- const handleLocaleChange = async (locale: Locale) => {
- if (!currentUser) return;
- // Apply locale immediately for instant UI feedback and persist to localStorage
- loadLocale(locale);
- // Persist to user settings
- updateUserGeneralSetting(
- { generalSetting: { locale }, updateMask: ["locale"] },
- {
- onSuccess: () => {
- refetchSettings();
- },
- },
- );
- };
-
- const handleThemeChange = async (theme: string) => {
- if (!currentUser) return;
- // Apply theme immediately for instant UI feedback
- loadTheme(theme);
- // Persist to user settings
- updateUserGeneralSetting(
- { generalSetting: { theme }, updateMask: ["theme"] },
- {
- onSuccess: () => {
- refetchSettings();
- },
- },
- );
+ const navigateFromMenu = (path: string) => {
+ onClose();
+ setMobileOpen(false);
+ navigateTo(path);
};
const handleSignOut = async () => {
- // First, clear auth state and cache BEFORE doing anything else
await logout();
-
try {
- // Then clear user-specific localStorage items
- // Preserve app-wide settings (theme, locale, view preferences, tag view settings)
const keysToPreserve = ["memos-theme", "memos-locale", "memos-view-setting", "tag-view-as-tree"];
const keysToRemove: string[] = [];
-
for (let i = 0; i < localStorage.length; i++) {
const key = localStorage.key(i);
- if (key && !keysToPreserve.includes(key)) {
- keysToRemove.push(key);
- }
+ if (key && !keysToPreserve.includes(key)) keysToRemove.push(key);
}
-
keysToRemove.forEach((key) => localStorage.removeItem(key));
} catch {
- // Ignore errors from localStorage operations
+ // Ignore errors from localStorage operations.
}
-
- // Always redirect to auth page (use replace to prevent back navigation)
window.location.replace(Routes.AUTH);
};
- const navigateFromMenu = (path: string) => {
- setMobileOpen(false);
- navigateTo(path);
- };
-
return (
- <DropdownMenu>
- <DropdownMenuTrigger
- disabled={!currentUser}
- aria-label={triggerLabel}
- className={cn(
- sidebarSurfaceVariants({ role: collapsed ? "accountCollapsed" : "account" }),
- "cursor-pointer text-start text-foreground transition-colors hover:bg-sidebar-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/50 data-popup-open:bg-sidebar-accent",
- )}
- >
- <div className={cn(SIDEBAR_LEADING_SLOT_CLASSES, "relative")}>
- {currentUser?.avatarUrl ? (
- <UserAvatar className="size-5 rounded-[5px]" avatarUrl={currentUser?.avatarUrl} />
- ) : (
- <User2Icon className="me-auto size-4 text-muted-foreground" />
- )}
- {sseStatus !== "connected" && (
- <Tooltip>
- <TooltipTrigger
- render={
- <span
- className={cn(
- "absolute -bottom-0.5 -end-0.5 size-2.5 rounded-full border-2 border-background",
- sseStatus === "connecting" ? "bg-muted-foreground animate-pulse" : "bg-destructive",
- )}
- />
- }
- />
- <TooltipContent side="right">{t(`live-update.${sseStatus}` as Parameters<typeof t>[0])}</TooltipContent>
- </Tooltip>
- )}
- </div>
- {!collapsed && (
- <span data-sidebar-label className="min-w-0 flex-1 truncate text-start text-[13px] font-medium text-foreground">
- {userLabel}
- </span>
- )}
- {!collapsed && (
- <span data-sidebar-trailing className="relative flex size-5 shrink-0 items-center justify-center">
- <MoreVerticalIcon className="size-4 text-muted-foreground/70" strokeWidth={1.8} />
- {unreadCount > 0 && (
+ <>
+ <section aria-label={t("setting.preference.label")} className="border-t border-border/70 px-2 py-1">
+ <Button variant="ghost" className={rowClass} onClick={() => onSelectPreference("theme")}>
+ <PaletteIcon className={iconClass} />
+ <span className="min-w-0 flex-1 text-start">{t("setting.preference.theme")}</span>
+ <span className="max-w-28 truncate text-muted-foreground">{themeLabel}</span>
+ <ChevronRightIcon className={iconClass} />
+ </Button>
+ <Button variant="ghost" className={rowClass} onClick={() => onSelectPreference("language")}>
+ <GlobeIcon className={iconClass} />
+ <span className="min-w-0 flex-1 text-start">{t("common.language")}</span>
+ <span className="max-w-24 truncate text-muted-foreground">{getLocaleDisplayName(currentLocale)}</span>
+ <ChevronRightIcon className={iconClass} />
+ </Button>
+ </section>
+ <section aria-label={t("setting.sso.account")} className="border-t border-border/70 px-2 py-1">
+ <div className="flex h-8 items-center gap-2 px-2">
+ <span className="relative flex size-5 shrink-0 items-center justify-center">
+ <UserAvatar avatarUrl={currentUser?.avatarUrl} name={accountLabel} className="size-5 rounded-[5px]" />
+ {sseStatus !== "connected" && (
<span
- aria-hidden="true"
- data-inbox-unread-indicator
- className="absolute end-0 top-0 size-1.5 rounded-full bg-primary ring-2 ring-sidebar"
+ role="img"
+ aria-label={t(`live-update.${sseStatus}` as Parameters<typeof t>[0])}
+ className={cn(
+ "absolute -bottom-0.5 -end-0.5 size-2.5 rounded-full border-2 border-popover",
+ sseStatus === "connecting" ? "animate-pulse bg-muted-foreground" : "bg-destructive",
+ )}
/>
)}
</span>
- )}
- </DropdownMenuTrigger>
- <DropdownMenuContent align={collapsed ? "start" : "center"} className={cn(!collapsed && "w-[calc(var(--anchor-width)-1.5rem)]")}>
- <DropdownMenuItem onClick={() => navigateFromMenu(`/u/${encodeURIComponent(currentUser?.username ?? "")}`)}>
- <SquareUserIcon className="size-4 text-muted-foreground" />
- {t("common.profile")}
- </DropdownMenuItem>
- <DropdownMenuItem
- aria-label={inboxLabel}
- aria-current={inboxActive ? "page" : undefined}
- className={cn(inboxActive && "bg-accent text-accent-foreground")}
- onClick={() => navigateFromMenu(Routes.INBOX)}
- >
- <BellIcon className="size-4 text-muted-foreground" />
- <span className="min-w-0 flex-1">{t("common.inbox")}</span>
- {unreadCount > 0 && (
- <span
- aria-hidden="true"
- className="ms-auto min-w-5 rounded-full bg-primary/10 px-1.5 text-center text-[10px] font-medium text-primary"
- >
- {unreadCount > 99 ? "99+" : unreadCount}
- </span>
- )}
- </DropdownMenuItem>
- <DropdownMenuItem
+ <span className="min-w-0 flex-1 truncate text-xs font-medium">{accountLabel}</span>
+ <Button
+ variant="ghost"
+ aria-label={inboxLabel}
+ aria-current={inboxActive ? "page" : undefined}
+ className={cn(
+ "h-5 gap-1 rounded-sm bg-muted/60 px-1.5 text-[10px] font-medium text-muted-foreground shadow-none hover:bg-accent hover:text-foreground",
+ inboxActive && "bg-accent text-foreground",
+ )}
+ onClick={() => navigateFromMenu(Routes.INBOX)}
+ >
+ <BellIcon className="size-3" />
+ {t("common.inbox")}
+ {unreadCount > 0 && <span className="tabular-nums text-primary">{unreadCount > 99 ? "99+" : unreadCount}</span>}
+ </Button>
+ </div>
+ <Button
+ variant="ghost"
aria-current={archivedActive ? "page" : undefined}
- className={cn(archivedActive && "bg-accent text-accent-foreground")}
+ className={cn(rowClass, archivedActive && "bg-accent")}
onClick={() => navigateFromMenu(Routes.ARCHIVED)}
>
- <ArchiveIcon className="size-4 text-muted-foreground" />
+ <ArchiveIcon className={iconClass} />
{t("common.archived")}
- </DropdownMenuItem>
- <DropdownMenuSeparator />
- <DropdownMenuSub>
- <DropdownMenuSubTrigger>
- <GlobeIcon className="size-4 text-muted-foreground" />
- {t("common.language")}
- </DropdownMenuSubTrigger>
- <DropdownMenuSubContent className="max-h-[min(24rem,var(--available-height))] overflow-y-auto p-0">
- <LocaleSearchList value={currentLocale} onChange={handleLocaleChange} className="w-64" />
- </DropdownMenuSubContent>
- </DropdownMenuSub>
- <DropdownMenuSub>
- <DropdownMenuSubTrigger>
- <PaletteIcon className="size-4 text-muted-foreground" />
- {t("setting.preference.theme")}
- </DropdownMenuSubTrigger>
- <DropdownMenuSubContent>
- {THEME_OPTIONS.map((option) => (
- <DropdownMenuItem key={option.value} onClick={() => handleThemeChange(option.value)}>
- {currentTheme === option.value && <CheckIcon className="w-4 h-auto" />}
- {currentTheme !== option.value && <span className="w-4" />}
- {option.label}
- </DropdownMenuItem>
- ))}
- </DropdownMenuSubContent>
- </DropdownMenuSub>
- <DropdownMenuItem onClick={() => navigateFromMenu(Routes.ABOUT)}>
- <InfoIcon className="size-4 text-muted-foreground" />
- {t("common.about")}
- </DropdownMenuItem>
- <DropdownMenuItem onClick={() => navigateFromMenu(Routes.SETTING)}>
- <SettingsIcon className="size-4 text-muted-foreground" />
+ </Button>
+ <Button variant="ghost" className={rowClass} onClick={() => navigateFromMenu(Routes.SETTING)}>
+ <SettingsIcon className={iconClass} />
{t("common.settings")}
- </DropdownMenuItem>
- <DropdownMenuSeparator />
- <DropdownMenuItem onClick={handleSignOut}>
- <LogOutIcon className="size-4 text-muted-foreground" />
+ </Button>
+ <Button variant="ghost" className={rowClass} onClick={() => navigateFromMenu(Routes.ABOUT)}>
+ <InfoIcon className={iconClass} />
+ {t("common.about")}
+ </Button>
+ <Button variant="ghost" className={cn(rowClass, "text-muted-foreground")} onClick={() => void handleSignOut()}>
+ <LogOutIcon className={iconClass} />
{t("common.sign-out")}
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
+ </Button>
+ </section>
+ </>
+ );
+};
+
+export const UserPreferenceDialog = ({ preference, onClose }: { preference: UserPreference; onClose: () => void }) => {
+ const t = useTranslate();
+ const currentUser = useCurrentUser();
+ const { userGeneralSetting, refetchSettings } = useAuth();
+ const { mutate: updateUserGeneralSetting } = useUpdateUserGeneralSetting(currentUser?.name);
+ const currentLocale = getLocaleWithFallback(userGeneralSetting?.locale);
+ const currentTheme = getThemeWithFallback(userGeneralSetting?.theme);
+
+ const handleLocaleChange = (locale: Locale) => {
+ if (!currentUser) return;
+ loadLocale(locale);
+ updateUserGeneralSetting({ generalSetting: { locale }, updateMask: ["locale"] }, { onSuccess: () => refetchSettings() });
+ onClose();
+ };
+
+ const handleThemeChange = (theme: string) => {
+ if (!currentUser) return;
+ loadTheme(theme);
+ updateUserGeneralSetting({ generalSetting: { theme }, updateMask: ["theme"] }, { onSuccess: () => refetchSettings() });
+ onClose();
+ };
+
+ return (
+ <Dialog open onOpenChange={(open) => !open && onClose()}>
+ <DialogContent size="sm">
+ <DialogHeader>
+ <DialogTitle>{preference === "theme" ? t("setting.preference.theme") : t("common.language")}</DialogTitle>
+ <DialogDescription>
+ {preference === "theme" ? t("setting.preference.theme-description") : t("setting.preference.language-description")}
+ </DialogDescription>
+ </DialogHeader>
+ {preference === "theme" ? (
+ <div className="rounded-md border p-1">
+ {THEME_OPTIONS.map((option) => (
+ <Button
+ key={option.value}
+ variant="ghost"
+ aria-pressed={currentTheme === option.value}
+ className={rowClass}
+ onClick={() => handleThemeChange(option.value)}
+ >
+ <span className="min-w-0 flex-1 text-start">{option.label}</span>
+ {currentTheme === option.value && <CheckIcon className="size-3.5 shrink-0" />}
+ </Button>
+ ))}
+ </div>
+ ) : (
+ <LocaleSearchList value={currentLocale} onChange={handleLocaleChange} className="w-full max-w-none" />
+ )}
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/web/src/components/ui/popover.tsx b/web/src/components/ui/popover.tsx
index 83b6a0894..42495ad88 100644
--- a/web/src/components/ui/popover.tsx
+++ b/web/src/components/ui/popover.tsx
@@ -14,11 +14,12 @@ PopoverTrigger.displayName = "PopoverTrigger";
const PopoverContent = React.forwardRef<
HTMLDivElement,
- PopoverPrimitive.Popup.Props & Pick<PopoverPrimitive.Positioner.Props, "align" | "alignOffset" | "side" | "sideOffset">
->(({ className, align = "center", alignOffset, side, sideOffset = 4, ...props }, ref) => {
+ PopoverPrimitive.Popup.Props & Pick<PopoverPrimitive.Positioner.Props, "anchor" | "align" | "alignOffset" | "side" | "sideOffset">
+>(({ className, anchor, align = "center", alignOffset, side, sideOffset = 4, ...props }, ref) => {
return (
<PopoverPrimitive.Portal>
<PopoverPrimitive.Positioner
+ anchor={anchor}
align={align}
alignOffset={alignOffset}
side={side}
diff --git a/web/src/contexts/AppSidebarContext.tsx b/web/src/contexts/AppSidebarContext.tsx
index 3d97018f3..9a5118c99 100644
--- a/web/src/contexts/AppSidebarContext.tsx
+++ b/web/src/contexts/AppSidebarContext.tsx
@@ -1,7 +1,6 @@
import { createContext, type ReactNode, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
import { useLocation } from "react-router-dom";
import type { MemoParentStatus } from "@/components/MemoParentPlaceholder";
-import type { PrimaryMemoScope } from "@/lib/memo-views";
import type { Memo } from "@/types/proto/api/v1/memo_service_pb";
export type AttachmentSection = "all" | "media" | "audio" | "documents" | "unused";
@@ -35,8 +34,6 @@ interface AppSidebarContextValue {
completeMobileClose: (open: boolean) => void;
quickFindOpen: boolean;
setQuickFindOpen: (open: boolean) => void;
- memoScope: PrimaryMemoScope;
- setMemoScope: (scope: PrimaryMemoScope) => void;
}
const AppSidebarContext = createContext<AppSidebarContextValue | null>(null);
@@ -50,7 +47,6 @@ export const AppSidebarProvider = ({ children }: { children: ReactNode }) => {
const pendingMobileCloseActionRef = useRef<(() => void) | undefined>(undefined);
const scheduledMobileCloseActionFrameRef = useRef<number | undefined>(undefined);
const [quickFindOpen, setQuickFindOpen] = useState(false);
- const [memoScope, setMemoScope] = useState<PrimaryMemoScope>("home");
useEffect(() => {
pendingMobileCloseActionRef.current = undefined;
@@ -116,10 +112,8 @@ export const AppSidebarProvider = ({ children }: { children: ReactNode }) => {
completeMobileClose,
quickFindOpen,
setQuickFindOpen,
- memoScope,
- setMemoScope,
}),
- [attachmentSection, inboxFilter, memoDetail, setMemoDetail, mobileOpen, closeMobileThen, completeMobileClose, quickFindOpen, memoScope],
+ [attachmentSection, inboxFilter, memoDetail, setMemoDetail, mobileOpen, closeMobileThen, completeMobileClose, quickFindOpen],
);
return <AppSidebarContext.Provider value={value}>{children}</AppSidebarContext.Provider>;
diff --git a/web/src/contexts/SpaceContext.tsx b/web/src/contexts/SpaceContext.tsx
index 85a23fb5d..4035e0e06 100644
--- a/web/src/contexts/SpaceContext.tsx
+++ b/web/src/contexts/SpaceContext.tsx
@@ -3,9 +3,17 @@ import { createContext, type ReactNode, useCallback, useContext, useMemo } from
import { useLocation, useNavigate } from "react-router-dom";
import useCurrentUser from "@/hooks/useCurrentUser";
import { useSpace, useSpaces } from "@/hooks/useSpaceQueries";
-import { buildCollectionScopeFilter, type CollectionScope } from "@/lib/cel-filter";
+import { buildCollectionScopeFilter, type CollectionScope, combineCELFilters } from "@/lib/cel-filter";
+import { buildMemoCreatorFilter } from "@/lib/resource-names";
import { getDuplicateSpaceTitles } from "@/lib/space-display";
-import { buildCollectionPath, ROUTES, resolveCollectionRoute } from "@/router/routes";
+import {
+ buildCollectionPath,
+ getCollectionCreator,
+ getCollectionHomePath,
+ ROUTES,
+ resolveCollectionRoute,
+ withCollectionCreator,
+} from "@/router/routes";
import type { Space } from "@/types/proto/api/v1/space_service_pb";
interface SpaceContextValue {
@@ -14,6 +22,7 @@ interface SpaceContextValue {
duplicateSpaceTitles: ReadonlySet<string>;
selectedSpace?: Space;
selectedSpaceName?: string;
+ creatorUsername?: string;
collectionScope: CollectionScope;
memoFilter?: string;
isLoadingSpaces: boolean;
@@ -29,10 +38,17 @@ const SpaceContext = createContext<SpaceContextValue | null>(null);
const NO_SPACES: Space[] = [];
export function SpaceProvider({ children }: { children: ReactNode }) {
- const userName = useCurrentUser()?.name;
+ const user = useCurrentUser();
+ const userName = user?.name;
const location = useLocation();
const navigate = useNavigate();
- const { spaceName: selectedSpaceName } = resolveCollectionRoute(location.pathname);
+ const route = resolveCollectionRoute(location.pathname);
+ const selectedSpaceName = route.spaceName;
+ const creatorUsername = route.isCollection
+ ? route.pathname === ROUTES.EXPLORE
+ ? undefined
+ : (getCollectionCreator(location.search) ?? (route.pathname === ROUTES.HOME ? user?.username : undefined))
+ : undefined;
const spacesQuery = useSpaces(userName);
const spaceQuery = useSpace(userName, selectedSpaceName);
const spaces = spacesQuery.data ?? NO_SPACES;
@@ -47,7 +63,13 @@ export function SpaceProvider({ children }: { children: ReactNode }) {
() => (selectedSpaceName ? { kind: "space", name: selectedSpaceName } : { kind: "all" }),
[selectedSpaceName],
);
- const selectSpace = useCallback((space: Space) => navigate(buildCollectionPath(ROUTES.HOME, space.name)), [navigate]);
+ const selectSpace = useCallback(
+ (space: Space) => {
+ const homePath = getCollectionHomePath(location);
+ navigate(`${buildCollectionPath(homePath, space.name)}${withCollectionCreator("", getCollectionCreator(location.search))}`);
+ },
+ [location, navigate],
+ );
const retrySpace = useCallback(() => {
void spaceQuery.refetch();
}, [spaceQuery.refetch]);
@@ -58,8 +80,12 @@ export function SpaceProvider({ children }: { children: ReactNode }) {
duplicateSpaceTitles,
selectedSpace,
selectedSpaceName,
+ creatorUsername,
collectionScope,
- memoFilter: buildCollectionScopeFilter(collectionScope),
+ memoFilter: combineCELFilters(
+ buildCollectionScopeFilter(collectionScope),
+ creatorUsername && buildMemoCreatorFilter(creatorUsername),
+ ),
isLoadingSpaces: spacesQuery.isPending,
isSpacesError: spacesQuery.isError,
isSpaceReady: !selectedSpaceName || (Boolean(userName) && spaceQuery.isSuccess),
@@ -73,6 +99,7 @@ export function SpaceProvider({ children }: { children: ReactNode }) {
duplicateSpaceTitles,
selectedSpace,
selectedSpaceName,
+ creatorUsername,
collectionScope,
spacesQuery.isPending,
spacesQuery.isError,
diff --git a/web/src/contexts/ViewContext.tsx b/web/src/contexts/ViewContext.tsx
index 662c4715b..3dc177915 100644
--- a/web/src/contexts/ViewContext.tsx
+++ b/web/src/contexts/ViewContext.tsx
@@ -1,4 +1,6 @@
import { createContext, type ReactNode, useContext, useState } from "react";
+import { useLocation } from "react-router-dom";
+import { ROUTES, resolveCollectionRoute } from "@/router/routes";
export type MemoTimeBasis = "create_time" | "update_time";
@@ -34,7 +36,7 @@ const LOCAL_STORAGE_KEY = "memos-view-setting";
const DEFAULT_VIEW_STATE: ViewState = { orderByTimeAsc: false, compactMode: false, linkPreview: true, maxColumns: 1 };
-export function ViewProvider({ children }: { children: ReactNode }) {
+export function ViewProvider({ children, enabled = true }: { children: ReactNode; enabled?: boolean }) {
const getInitialState = (): ViewState => {
try {
const cached = localStorage.getItem(LOCAL_STORAGE_KEY);
@@ -60,7 +62,9 @@ export function ViewProvider({ children }: { children: ReactNode }) {
};
const [viewState, setViewState] = useState(getInitialState);
- const timeBasis = viewState.timeBasis ?? "create_time";
+ // Keep the saved Timeline preferences while other views use their default presentation.
+ const activeState = enabled ? viewState : DEFAULT_VIEW_STATE;
+ const timeBasis = activeState.timeBasis ?? "create_time";
const persistToStorage = (newState: ViewState) => {
try {
@@ -70,9 +74,9 @@ export function ViewProvider({ children }: { children: ReactNode }) {
}
};
- const updateState = (patch: Partial<ViewState> | ((prev: ViewState) => Partial<ViewState>)) => {
+ const updateState = (patch: Partial<ViewState>) => {
setViewState((prev) => {
- const newState = { ...prev, ...(typeof patch === "function" ? patch(prev) : patch) };
+ const newState = { ...prev, ...patch };
persistToStorage(newState);
return newState;
});
@@ -87,11 +91,11 @@ export function ViewProvider({ children }: { children: ReactNode }) {
return (
<ViewContext.Provider
value={{
- orderByTimeAsc: viewState.orderByTimeAsc,
+ orderByTimeAsc: activeState.orderByTimeAsc,
timeBasis,
- compactMode: viewState.compactMode,
- linkPreview: viewState.linkPreview,
- maxColumns: viewState.maxColumns,
+ compactMode: activeState.compactMode,
+ linkPreview: activeState.linkPreview,
+ maxColumns: activeState.maxColumns,
setOrderByTimeAsc,
setTimeBasis,
setCompactMode,
@@ -104,6 +108,15 @@ export function ViewProvider({ children }: { children: ReactNode }) {
);
}
+/** Timeline preferences also apply to its sidebar statistics and date filters. */
+export function TimelineViewProvider({ children }: { children: ReactNode }) {
+ const { pathname } = useLocation();
+ const route = resolveCollectionRoute(pathname);
+ const collectionPath = route.pathname.toLowerCase();
+ const enabled = route.isCollection && (collectionPath === ROUTES.HOME || collectionPath === ROUTES.EXPLORE);
+ return <ViewProvider enabled={enabled}>{children}</ViewProvider>;
+}
+
export function useView() {
const context = useContext(ViewContext);
if (!context) {
diff --git a/web/src/hooks/useFilteredMemoStats.ts b/web/src/hooks/useFilteredMemoStats.ts
index 7e5c49eca..b31ca9f7a 100644
--- a/web/src/hooks/useFilteredMemoStats.ts
+++ b/web/src/hooks/useFilteredMemoStats.ts
@@ -5,7 +5,6 @@ import { useMemo } from "react";
import { type MemoTimeBasis, useView } from "@/contexts/ViewContext";
import useCurrentUser from "@/hooks/useCurrentUser";
import { useAllUserStats, useUserStats } from "@/hooks/useUserQueries";
-import { combineCELFilters } from "@/lib/cel-filter";
import { mergeTagCounts } from "@/lib/tag";
import { State } from "@/types/proto/api/v1/common_pb";
import type { UserStats } from "@/types/proto/api/v1/user_service_pb";
@@ -17,7 +16,7 @@ export interface FilteredMemoStats {
loading: boolean;
}
-export type MemoStatsContext = "home" | "explore" | "archived" | "profile";
+export type MemoStatsContext = "home" | "collection" | "archived";
export interface UseFilteredMemoStatsOptions {
userName?: string;
@@ -44,19 +43,14 @@ export const useFilteredMemoStats = (options: UseFilteredMemoStatsOptions = {}):
const currentUser = useCurrentUser();
const { timeBasis } = useView();
- // home/profile: use backend per-user stats (full tag set, not page-limited)
+ // Legacy personal collections use backend per-user stats.
const { data: userStats, isLoading: isLoadingUserStats } = useUserStats(userName, { enabled, filter });
- // explore/archived: fetch backend grouped stats and aggregate them locally.
+ // Collection and Archived fetch grouped stats and aggregate them locally.
// ListAllUserStats AND's the request filter with the server's auth filter, so
// private memos are not included unless explicitly visible to the current user.
- const exploreVisibilityFilter = currentUser != null ? 'visibility in ["PUBLIC", "PROTECTED", "SPACE"]' : 'visibility in ["PUBLIC"]';
const allUserStatsRequest =
- context === "explore"
- ? { state: State.NORMAL, filter: combineCELFilters(filter, exploreVisibilityFilter) }
- : context === "archived"
- ? { state: State.ARCHIVED, filter }
- : {};
- const shouldFetchAllUserStats = context === "explore" || (context === "archived" && !!currentUser?.name);
+ context === "collection" ? { state: State.NORMAL, filter } : context === "archived" ? { state: State.ARCHIVED, filter } : {};
+ const shouldFetchAllUserStats = context === "collection" || (context === "archived" && !!currentUser?.name);
const { data: allUserStats = [], isLoading: isLoadingAllUserStats } = useAllUserStats(allUserStatsRequest, {
enabled: enabled && shouldFetchAllUserStats,
});
@@ -66,7 +60,7 @@ export const useFilteredMemoStats = (options: UseFilteredMemoStatsOptions = {}):
let activityStats: Record<string, number> = {};
let tagCount: Record<string, number> = mergeTagCounts();
- if (context === "explore" || context === "archived") {
+ if (context === "collection" || context === "archived") {
const displayDates: string[] = [];
tagCount = mergeTagCounts(...allUserStats.map((stats) => stats.tagCount));
for (const stats of allUserStats) {
@@ -79,7 +73,7 @@ export const useFilteredMemoStats = (options: UseFilteredMemoStatsOptions = {}):
}
activityStats = countBy(displayDates);
} else if (userName && userStats) {
- // home/profile: use backend per-user stats.
+ // Legacy personal collections use backend per-user stats.
const sourceArray = timestampsForBasis(userStats, timeBasis);
if (sourceArray.length > 0) {
activityStats = countBy(
diff --git a/web/src/lib/memo-views.ts b/web/src/lib/memo-views.ts
index 251e9d71c..8cd94f01e 100644
--- a/web/src/lib/memo-views.ts
+++ b/web/src/lib/memo-views.ts
@@ -2,7 +2,6 @@ import { matchPath } from "react-router-dom";
import { ROUTES, resolveCollectionRoute } from "@/router/routes";
export type MemoScope = "home" | "explore" | "archived";
-export type PrimaryMemoScope = Exclude<MemoScope, "archived">;
export const BUILTIN_TASKS_VIEW_ID = "__built_in_tasks__";
export const BUILTIN_TASKS_VIEW_FILTER = "has_task_list && has_incomplete_tasks";
@@ -25,14 +24,6 @@ export const isMemoScopeRoute = (pathname: string): boolean => {
return comparablePath === ROUTES.HOME || comparablePath === ROUTES.EXPLORE || comparablePath === ROUTES.ARCHIVED;
};
-const PROFILE_ROUTE_PATTERN = /^\/u\/([^/]+)$/i;
-
-/** The decoded username when `pathname` is a user profile (`/u/:username`), else undefined. */
-export const getProfileUsername = (pathname: string): string | undefined => {
- const match = cleanPathname(pathname).match(PROFILE_ROUTE_PATTERN);
- return match ? decodeURIComponent(match[1]) : undefined;
-};
-
/** `/calendar` and any month or day beneath it. */
export const isCalendarRoute = (pathname: string): boolean => {
const comparablePath = comparablePathname(pathname);
@@ -40,19 +31,13 @@ export const isCalendarRoute = (pathname: string): boolean => {
};
/**
- * Routes that render a memo collection the sidebar can narrow: the scope routes, a user
- * profile and the calendar. Views, calendar days and tags apply in place on all of them.
+ * Routes that render a memo collection the sidebar can narrow. Views, calendar days,
+ * and tags apply in place on all of them.
*/
export const isMemoCollectionRoute = (pathname: string): boolean =>
- isMemoScopeRoute(pathname) ||
- getProfileUsername(pathname) !== undefined ||
- isCalendarRoute(pathname) ||
- matchPath(ROUTES.MAP, comparablePathname(pathname)) !== null;
-
-export const getMemoScopePath = (scope: PrimaryMemoScope): string => (scope === "explore" ? ROUTES.EXPLORE : ROUTES.HOME);
+ isMemoScopeRoute(pathname) || isCalendarRoute(pathname) || matchPath(ROUTES.MAP, comparablePathname(pathname)) !== null;
interface ResolveMemoScopeOptions {
- currentUsername?: string;
detailFrom?: string;
memoArchived?: boolean;
fallback?: MemoScope;
@@ -65,14 +50,8 @@ export const resolveMemoScope = (pathname: string, options: ResolveMemoScopeOpti
if (comparablePath === ROUTES.ARCHIVED) return "archived";
if (comparablePath === ROUTES.HOME) return "home";
- const profileUsername = getProfileUsername(cleanPath);
- if (profileUsername !== undefined) {
- return options.currentUsername && profileUsername === options.currentUsername ? "home" : "explore";
- }
-
if (comparablePath.startsWith("/memos/") && options.detailFrom) {
return resolveMemoScope(options.detailFrom, {
- currentUsername: options.currentUsername,
fallback: options.fallback,
});
}
diff --git a/web/src/locales/ar.json b/web/src/locales/ar.json
index e2971fe08..29f871a06 100644
--- a/web/src/locales/ar.json
+++ b/web/src/locales/ar.json
@@ -54,6 +54,7 @@
"attachments": "مرفقات",
"avatar": "الصورة الشخصية",
"basic": "بسيط",
+ "browse": "تصفح",
"calendar": "التقويم",
"cancel": "ألغِ",
"clear": "مسح",
@@ -80,6 +81,7 @@
"explore": "استكشف",
"filter": "تنقيح",
"home": "الصفحة الرئيسية",
+ "timeline": "الخط الزمني",
"inbox": "الوارد",
"language": "اللغة",
"last-updated-at": "آخر تحديث في",
@@ -963,11 +965,6 @@
"banner-title": "عرض توضيحي Memos",
"deploy-link": "انشر Memos الخاص بك"
},
- "profile": {
- "no-shared-memos": "لم يشارك المستخدم {{username}} أي مذكرات حتى الآن.",
- "not-found-description": "لا يوجد مستخدم Memos باسم @{{username}} في هذه النسخة.",
- "not-found-title": "لا يوجد أحد هنا."
- },
"search": {
"access-error": "ليس لديك صلاحية الوصول إلى هذه المذكرات.",
"clear-query": "مسح الاستعلام",
@@ -983,6 +980,7 @@
"text": "نص"
},
"space": {
+ "all-spaces": "جميع المساحات",
"icon": {
"change": "تغيير رمز المساحة",
"kind": "نوع الرمز",
diff --git a/web/src/locales/az.json b/web/src/locales/az.json
index 21b38f84a..055ffca34 100644
--- a/web/src/locales/az.json
+++ b/web/src/locales/az.json
@@ -151,6 +151,7 @@
"attachments": "Qoşmalar",
"avatar": "Avatar",
"basic": "Əsas",
+ "browse": "Baxış",
"calendar": "Təqvim",
"cancel": "Ləğv et",
"clear": "Təmizlə",
@@ -180,6 +181,7 @@
"explore": "Kəşf et",
"filter": "Süzgəc",
"home": "Əsas səhifə",
+ "timeline": "Zaman xətti",
"inbox": "Gələnlər",
"language": "Dil",
"last-updated-at": "Son yenilənmə",
@@ -432,11 +434,6 @@
"succeed-copy-link": "Keçid uğurla kopyalandı.",
"update-succeed": "Yeniləmə uğurlu oldu"
},
- "profile": {
- "no-shared-memos": "@{{username}} hələ heç bir qeyd paylaşmayıb.",
- "not-found-description": "Bu instansda @{{username}} adlı Memos istifadəçisi yoxdur.",
- "not-found-title": "Burada heç kim yoxdur"
- },
"reference": {
"no-memos-found": "Qeyd tapılmadı",
"search-placeholder": "Məzmunda axtar"
@@ -979,6 +976,7 @@
}
},
"space": {
+ "all-spaces": "Bütün məkanlar",
"icon": {
"change": "Sahə ikonunu dəyiş",
"kind": "İkon növü",
diff --git a/web/src/locales/bg.json b/web/src/locales/bg.json
index cca3c6d52..a0796c8d9 100644
--- a/web/src/locales/bg.json
+++ b/web/src/locales/bg.json
@@ -92,6 +92,7 @@
"attachments": "Прикачени файлове",
"avatar": "Аватар",
"basic": "Основен",
+ "browse": "Разглеждане",
"calendar": "Календар",
"cancel": "Отказ",
"clear": "ясно",
@@ -119,6 +120,7 @@
"explore": "Разгледайте",
"filter": "Филтър",
"home": "Начало",
+ "timeline": "Хронология",
"inbox": "Входяща кутия",
"language": "език",
"last-updated-at": "Последна актуализация на",
@@ -977,12 +979,8 @@
"previous-year": "Предишна година",
"select-month": "Изберете месец"
},
- "profile": {
- "no-shared-memos": "@{{username}} все още не е споделил никакви бележки.",
- "not-found-description": "Няма потребител на Memos с име @{{username}} в този екземпляр.",
- "not-found-title": "Няма никой тук"
- },
"space": {
+ "all-spaces": "Всички пространства",
"icon": {
"change": "Промяна на икона на пространство",
"kind": "Тип икона",
diff --git a/web/src/locales/ca.json b/web/src/locales/ca.json
index 76ba9220e..ff2b25e03 100644
--- a/web/src/locales/ca.json
+++ b/web/src/locales/ca.json
@@ -54,6 +54,7 @@
"attachments": "Adjunts",
"avatar": "Avatar",
"basic": "Bàsic",
+ "browse": "Navega",
"calendar": "Calendari",
"cancel": "Cancel·lar",
"clear": "Netejar",
@@ -80,6 +81,7 @@
"explore": "Explora",
"filter": "Filtra",
"home": "Inici",
+ "timeline": "Cronologia",
"inbox": "Bústia d'entrada",
"language": "Llenguatge",
"last-updated-at": "Darrera actualització el",
@@ -977,12 +979,8 @@
"previous-year": "L'any anterior",
"select-month": "Selecciona el mes"
},
- "profile": {
- "no-shared-memos": "@{{username}} encara no ha compartit cap nota.",
- "not-found-description": "No hi ha cap usuari Memos anomenat @{{username}} en aquesta instància.",
- "not-found-title": "No hi ha ningú aquí"
- },
"space": {
+ "all-spaces": "Tots els espais",
"icon": {
"change": "Canvia la icona de l'espai",
"kind": "Tipus d'icona",
diff --git a/web/src/locales/cs.json b/web/src/locales/cs.json
index d217601ed..36b1fdcbc 100644
--- a/web/src/locales/cs.json
+++ b/web/src/locales/cs.json
@@ -54,6 +54,7 @@
"attachments": "Přílohy",
"avatar": "Avatar",
"basic": "Základní",
+ "browse": "Procházet",
"calendar": "Kalendář",
"cancel": "Zrušit",
"clear": "Vymazat",
@@ -80,6 +81,7 @@
"explore": "Prozkoumat",
"filter": "Filtr",
"home": "Domů",
+ "timeline": "Časová osa",
"inbox": "Došlá pošta",
"language": "Jazyk",
"last-updated-at": "Změněno",
@@ -977,12 +979,8 @@
"previous-year": "Předchozí rok",
"select-month": "Vyberte měsíc"
},
- "profile": {
- "no-shared-memos": "@{{username}} zatím nesdílel(a) žádné poznámky.",
- "not-found-description": "V této instanci není žádný uživatel Memos s názvem @{{username}}.",
- "not-found-title": "Nikdo zde není"
- },
"space": {
+ "all-spaces": "Všechny prostory",
"icon": {
"change": "Změnit ikonu prostoru",
"kind": "Typ ikony",
diff --git a/web/src/locales/da.json b/web/src/locales/da.json
index 1f87857a4..4dd42067e 100644
--- a/web/src/locales/da.json
+++ b/web/src/locales/da.json
@@ -92,6 +92,7 @@
"attachments": "Vedhæftede filer",
"avatar": "Avatar",
"basic": "Grundlæggende",
+ "browse": "Gennemse",
"calendar": "Kalender",
"cancel": "Ophæve",
"clear": "Klar",
@@ -119,6 +120,7 @@
"explore": "Udforske",
"filter": "Filter",
"home": "Hjem",
+ "timeline": "Tidslinje",
"inbox": "Indbakke",
"language": "Sprog",
"last-updated-at": "Sidst opdateret kl",
@@ -977,12 +979,8 @@
"previous-year": "Forrige år",
"select-month": "Vælg måned"
},
- "profile": {
- "no-shared-memos": "@{{username}} har endnu ikke delt nogen notater.",
- "not-found-description": "Der er ingen Memos bruger ved navn @{{username}} på denne instans.",
- "not-found-title": "Ingen her"
- },
"space": {
+ "all-spaces": "Alle rum",
"icon": {
"change": "Skift ikon for rum",
"kind": "Ikontype",
diff --git a/web/src/locales/de.json b/web/src/locales/de.json
index 077998df5..8efaa3396 100644
--- a/web/src/locales/de.json
+++ b/web/src/locales/de.json
@@ -54,6 +54,7 @@
"attachments": "Anhänge",
"avatar": "Avatar",
"basic": "Allgemeines",
+ "browse": "Durchsuchen",
"calendar": "Kalender",
"cancel": "Abbrechen",
"clear": "Leeren",
@@ -80,6 +81,7 @@
"explore": "Erkunden",
"filter": "Filter",
"home": "Startseite",
+ "timeline": "Zeitleiste",
"inbox": "Eingang",
"language": "Sprache",
"last-updated-at": "Zuletzt aktualisiert am",
@@ -977,12 +979,8 @@
"previous-year": "Vorheriges Jahr",
"select-month": "Monat auswählen"
},
- "profile": {
- "no-shared-memos": "@{{username}} hat noch keine Memos geteilt.",
- "not-found-description": "Es gibt keinen Benutzer Memos mit dem Namen @{{username}} in dieser Instanz.",
- "not-found-title": "Niemand hier"
- },
"space": {
+ "all-spaces": "Alle Bereiche",
"icon": {
"change": "Bereichssymbol ändern",
"kind": "Symboltyp",
diff --git a/web/src/locales/el.json b/web/src/locales/el.json
index 612d43055..1878a6d37 100644
--- a/web/src/locales/el.json
+++ b/web/src/locales/el.json
@@ -92,6 +92,7 @@
"attachments": "Συνημμένα",
"avatar": "Avatar",
"basic": "Βασικός",
+ "browse": "Περιήγηση",
"calendar": "Ημερολόγιο",
"cancel": "Ματαίωση",
"clear": "Σαφής",
@@ -119,6 +120,7 @@
"explore": "Εξερευνώ",
"filter": "Φίλτρο",
"home": "Σπίτι",
+ "timeline": "Χρονολόγιο",
"inbox": "Εισερχόμενα",
"language": "Γλώσσα",
"last-updated-at": "Τελευταία ενημέρωση στις",
@@ -977,12 +979,8 @@
"previous-year": "Προηγούμενο έτος",
"select-month": "Επιλογή μήνα"
},
- "profile": {
- "no-shared-memos": "Ο χρήστης @{{username}} δεν έχει μοιραστεί ακόμη κανένα σημείωμα.",
- "not-found-description": "Δεν υπάρχει χρήστης Memos με το όνομα @{{username}} σε αυτήν την παρουσία.",
- "not-found-title": "Κανείς εδώ"
- },
"space": {
+ "all-spaces": "Όλοι οι χώροι",
"icon": {
"change": "Αλλαγή εικονιδίου χώρου",
"kind": "Τύπος εικονιδίου",
diff --git a/web/src/locales/en-GB.json b/web/src/locales/en-GB.json
index 86b965fcd..d89cca592 100644
--- a/web/src/locales/en-GB.json
+++ b/web/src/locales/en-GB.json
@@ -54,6 +54,7 @@
"attachments": "Attachments",
"avatar": "Avatar",
"basic": "Basic",
+ "browse": "Browse",
"calendar": "Calendar",
"cancel": "Cancel",
"clear": "Clear",
@@ -80,6 +81,7 @@
"explore": "Explore",
"filter": "Filter",
"home": "Home",
+ "timeline": "Timeline",
"inbox": "Inbox",
"language": "Language",
"last-updated-at": "Last updated at",
@@ -963,11 +965,6 @@
"timezone-unknown": "Time zone unknown",
"title": "Details"
},
- "profile": {
- "no-shared-memos": "@{{username}} hasn't shared any memos yet.",
- "not-found-description": "There's no Memos user named @{{username}} on this instance.",
- "not-found-title": "No one here"
- },
"search": {
"access-error": "You don’t have access to these memos.",
"clear-query": "Clear query",
@@ -983,6 +980,7 @@
"text": "Text"
},
"space": {
+ "all-spaces": "All spaces",
"icon": {
"change": "Change space icon",
"kind": "Icon type",
diff --git a/web/src/locales/en.json b/web/src/locales/en.json
index ebbc5233e..eddb21eb7 100644
--- a/web/src/locales/en.json
+++ b/web/src/locales/en.json
@@ -151,6 +151,7 @@
"attachments": "Attachments",
"avatar": "Avatar",
"basic": "Basic",
+ "browse": "Browse",
"calendar": "Calendar",
"cancel": "Cancel",
"clear": "Clear",
@@ -180,6 +181,7 @@
"explore": "Explore",
"filter": "Filter",
"home": "Home",
+ "timeline": "Timeline",
"inbox": "Inbox",
"language": "Language",
"last-updated-at": "Last updated at",
@@ -432,11 +434,6 @@
"succeed-copy-link": "Link copied successfully.",
"update-succeed": "Update succeeded"
},
- "profile": {
- "no-shared-memos": "@{{username}} hasn't shared any memos yet.",
- "not-found-description": "There's no Memos user named @{{username}} on this instance.",
- "not-found-title": "No one here"
- },
"reference": {
"no-memos-found": "No memos found",
"search-placeholder": "Search content"
@@ -979,6 +976,7 @@
}
},
"space": {
+ "all-spaces": "All spaces",
"icon": {
"change": "Change space icon",
"kind": "Icon type",
diff --git a/web/src/locales/es.json b/web/src/locales/es.json
index a82b33067..8da44afb5 100644
--- a/web/src/locales/es.json
+++ b/web/src/locales/es.json
@@ -54,6 +54,7 @@
"attachments": "Adjuntos",
"avatar": "Avatar",
"basic": "Básico",
+ "browse": "Navegar",
"calendar": "Calendario",
"cancel": "Cancelar",
"clear": "Borrar",
@@ -80,6 +81,7 @@
"explore": "Explorar",
"filter": "Filtro",
"home": "Inicio",
+ "timeline": "Cronología",
"inbox": "Bandeja de entrada",
"language": "Idioma",
"last-updated-at": "Última actualización en",
@@ -977,12 +979,8 @@
"previous-year": "Año anterior",
"select-month": "Seleccionar mes"
},
- "profile": {
- "no-shared-memos": "@{{username}} aún no ha compartido ningún memo.",
- "not-found-description": "No existe ningún usuario Memos llamado @{{username}} en esta instancia.",
- "not-found-title": "No hay nadie aquí"
- },
"space": {
+ "all-spaces": "Todos los espacios",
"icon": {
"change": "Cambiar icono del espacio",
"kind": "Tipo de icono",
diff --git a/web/src/locales/et.json b/web/src/locales/et.json
index e200a9d83..208b547be 100644
--- a/web/src/locales/et.json
+++ b/web/src/locales/et.json
@@ -92,6 +92,7 @@
"attachments": "Manused",
"avatar": "Avatar",
"basic": "Põhiline",
+ "browse": "Sirvi",
"calendar": "Kalender",
"cancel": "Tühista",
"clear": "Selge",
@@ -119,6 +120,7 @@
"explore": "Uurige",
"filter": "Filter",
"home": "Kodu",
+ "timeline": "Ajajoon",
"inbox": "Postkast",
"language": "Keel",
"last-updated-at": "Viimati värskendatud kell",
@@ -977,12 +979,8 @@
"previous-year": "Eelmisel aastal",
"select-month": "Valige kuu"
},
- "profile": {
- "no-shared-memos": "@{{username}} pole veel ühtegi memo jaganud.",
- "not-found-description": "Sellel eksemplaril pole Memos kasutajat nimega @{{username}}.",
- "not-found-title": "Siin pole kedagi"
- },
"space": {
+ "all-spaces": "Kõik ruumid",
"icon": {
"change": "Muuda ruumi ikooni",
"kind": "Ikooni tüüp",
diff --git a/web/src/locales/fa.json b/web/src/locales/fa.json
index f6d880cd6..e6c05dbdc 100644
--- a/web/src/locales/fa.json
+++ b/web/src/locales/fa.json
@@ -54,6 +54,7 @@
"attachments": "پیوست‌ها",
"avatar": "آواتار",
"basic": "ساده",
+ "browse": "مرور",
"calendar": "تقویم",
"cancel": "لغو",
"clear": "پاکسازی",
@@ -80,6 +81,7 @@
"explore": "کاوش",
"filter": "فیلتر",
"home": "خانه",
+ "timeline": "خط زمانی",
"inbox": "صندوق ورودی",
"language": "زبان",
"last-updated-at": "آخرین بروزرسانی در",
@@ -963,11 +965,6 @@
"banner-title": "نسخه آزمایشی Memos",
"deploy-link": "پیاده‌سازی Memos خودتان"
},
- "profile": {
- "no-shared-memos": "@{{username}} هنوز هیچ یادداشتی را به اشتراک نگذاشته است.",
- "not-found-title": "کسی اینجا نیست.",
- "not-found-description": "در این نمونهٔ Memos کاربری با نام @{{username}} وجود ندارد."
- },
"search": {
"access-error": "شما به این یادداشت‌ها دسترسی ندارید.",
"clear-query": "پاک کردن پرس‌وجو",
@@ -983,6 +980,7 @@
"text": "متن"
},
"space": {
+ "all-spaces": "همه فضاها",
"icon": {
"change": "تغییر آیکون فضا",
"kind": "نوع آیکون",
diff --git a/web/src/locales/fi.json b/web/src/locales/fi.json
index 5263c6763..4d12364ae 100644
--- a/web/src/locales/fi.json
+++ b/web/src/locales/fi.json
@@ -92,6 +92,7 @@
"attachments": "Liitteet",
"avatar": "Avatar",
"basic": "Perus",
+ "browse": "Selaa",
"calendar": "Kalenteri",
"cancel": "Peruuttaa",
"clear": "Selkeä",
@@ -119,6 +120,7 @@
"explore": "Tutkia",
"filter": "Suodattaa",
"home": "Kotiin",
+ "timeline": "Aikajana",
"inbox": "Saapuneet",
"language": "Kieli",
"last-updated-at": "Viimeksi päivitetty klo",
@@ -977,12 +979,8 @@
"previous-year": "Edellisessä vuodessa",
"select-month": "Valitse kuukausi"
},
- "profile": {
- "no-shared-memos": "@{{username}} ei ole vielä jakanut muistioita.",
- "not-found-description": "Tässä instanssissa ei ole Memos käyttäjää nimeltä @{{username}}.",
- "not-found-title": "Ei ketään täällä"
- },
"space": {
+ "all-spaces": "Kaikki tilat",
"icon": {
"change": "Vaihda tilan kuvaketta",
"kind": "Kuvakkeen tyyppi",
diff --git a/web/src/locales/fr.json b/web/src/locales/fr.json
index c5ec1a3ba..57d244a69 100644
--- a/web/src/locales/fr.json
+++ b/web/src/locales/fr.json
@@ -54,6 +54,7 @@
"attachments": "Pièces jointes",
"avatar": "Avatar",
"basic": "Basique",
+ "browse": "Parcourir",
"calendar": "Calendrier",
"cancel": "Annuler",
"clear": "Effacer",
@@ -80,6 +81,7 @@
"explore": "Explorer",
"filter": "Filtrer",
"home": "Accueil",
+ "timeline": "Chronologie",
"inbox": "Boîte de réception",
"language": "Langue",
"last-updated-at": "Dernière mise à jour le",
@@ -977,12 +979,8 @@
"previous-year": "Année précédente",
"select-month": "Sélectionner un mois"
},
- "profile": {
- "no-shared-memos": "@{{username}} n'a encore partagé aucun mémo.",
- "not-found-description": "Il n'y a pas d'utilisateur Memos nommé @{{username}} sur cette instance.",
- "not-found-title": "Personne ici"
- },
"space": {
+ "all-spaces": "Tous les espaces",
"icon": {
"change": "Changer l'icône de l'espace",
"kind": "Type d'icône",
diff --git a/web/src/locales/gl.json b/web/src/locales/gl.json
index fcb029072..e4e0e82c1 100644
--- a/web/src/locales/gl.json
+++ b/web/src/locales/gl.json
@@ -54,6 +54,7 @@
"attachments": "Anexos",
"avatar": "Avatar",
"basic": "Básico",
+ "browse": "Navegar",
"calendar": "Calendario",
"cancel": "Cancelar",
"clear": "Limpar",
@@ -80,6 +81,7 @@
"explore": "Descubrir",
"filter": "Filtro",
"home": "Inicio",
+ "timeline": "Cronoloxía",
"inbox": "Caixa de entrada",
"language": "Idioma",
"last-updated-at": "Última actualización",
@@ -977,12 +979,8 @@
"previous-year": "Ano anterior",
"select-month": "Seleccionar mes"
},
- "profile": {
- "no-shared-memos": "@{{username}} aínda non compartiu ningunha nota.",
- "not-found-description": "Non hai ningún usuario Memos chamado @{{username}} nesta instancia.",
- "not-found-title": "Non hai ninguén aquí"
- },
"space": {
+ "all-spaces": "Todos os espazos",
"icon": {
"change": "Cambiar icona do espazo",
"kind": "Tipo de icona",
diff --git a/web/src/locales/he.json b/web/src/locales/he.json
index ed0c5a6fd..4c4160cfa 100644
--- a/web/src/locales/he.json
+++ b/web/src/locales/he.json
@@ -126,6 +126,7 @@
"attachments": "קבצים מצורפים",
"avatar": "תמונת פרופיל",
"basic": "בסיסי",
+ "browse": "עיון",
"calendar": "לוח שנה",
"cancel": "ביטול",
"clear": "נקה",
@@ -153,6 +154,7 @@
"explore": "גלה",
"filter": "סנן",
"home": "דף הבית",
+ "timeline": "ציר זמן",
"inbox": "תיבת הדואר הנכנס",
"language": "שפה",
"last-updated-at": "עודכן לאחרונה בתאריך",
@@ -977,12 +979,8 @@
"previous-year": "שנה קודמת",
"select-month": "בחר חודש"
},
- "profile": {
- "no-shared-memos": "@{{username}} עדיין לא שיתף תזכירים.",
- "not-found-description": "אין משתמש Memos בשם @{{username}} במופע זה.",
- "not-found-title": "אין כאן אף אחד"
- },
"space": {
+ "all-spaces": "כל המרחבים",
"icon": {
"change": "שינוי סמל המרחב",
"kind": "סוג סמל",
diff --git a/web/src/locales/hi.json b/web/src/locales/hi.json
index 67937c727..7532863ba 100644
--- a/web/src/locales/hi.json
+++ b/web/src/locales/hi.json
@@ -54,6 +54,7 @@
"attachments": "संलग्नक",
"avatar": "अवतार",
"basic": "मूल",
+ "browse": "ब्राउज़ करें",
"calendar": "कैलेंडर",
"cancel": "रद्द करें",
"clear": "साफ़ करें",
@@ -80,6 +81,7 @@
"explore": "अन्वेषण करें",
"filter": "फ़िल्टर",
"home": "होम",
+ "timeline": "समयरेखा",
"inbox": "इनबॉक्स",
"language": "भाषा",
"last-updated-at": "अंतिम अपडेट",
@@ -963,11 +965,6 @@
"banner-title": "Memos डेमो",
"deploy-link": "अपना खुद का डिप्लॉय करें Memos"
},
- "profile": {
- "no-shared-memos": "@{{username}} ने अभी तक कोई मेमो शेयर नहीं किया है।",
- "not-found-description": "इस इंस्टेंस पर @{{username}} नाम का कोई Memos यूज़र नहीं है.",
- "not-found-title": "यहाँ कोई नहीं है"
- },
"search": {
"access-error": "आपके पास इन मेमो का एक्सेस नहीं है.",
"clear-query": "क्वेरी क्लियर करें",
@@ -983,6 +980,7 @@
"text": "टेक्स्ट"
},
"space": {
+ "all-spaces": "सभी स्पेस",
"icon": {
"change": "स्पेस आइकन बदलें",
"kind": "आइकन टाइप",
diff --git a/web/src/locales/hr.json b/web/src/locales/hr.json
index 74c95209f..bb0848efb 100644
--- a/web/src/locales/hr.json
+++ b/web/src/locales/hr.json
@@ -54,6 +54,7 @@
"attachments": "Privici",
"avatar": "Avatar",
"basic": "Osnovno",
+ "browse": "Pregledaj",
"calendar": "Kalendar",
"cancel": "Otkaži",
"clear": "Očisti",
@@ -80,6 +81,7 @@
"explore": "Istraži",
"filter": "Filtriraj",
"home": "Glavna",
+ "timeline": "Vremenska crta",
"inbox": "Ulazna pošta",
"language": "Jezik",
"last-updated-at": "Zadnje ažurirano",
@@ -977,12 +979,8 @@
"previous-year": "Prethodna godina",
"select-month": "Odaberite mjesec"
},
- "profile": {
- "no-shared-memos": "@{{username}} još nije podijelio nijedan podsjetnik.",
- "not-found-description": "Nema korisnika Memos pod imenom @{{username}} na ovoj instanci.",
- "not-found-title": "Nitko ovdje"
- },
"space": {
+ "all-spaces": "Svi prostori",
"icon": {
"change": "Promijeni ikonu prostora",
"kind": "Vrsta ikone",
diff --git a/web/src/locales/hu.json b/web/src/locales/hu.json
index 34c377fc0..fc759db44 100644
--- a/web/src/locales/hu.json
+++ b/web/src/locales/hu.json
@@ -54,6 +54,7 @@
"attachments": "Mellékletek",
"avatar": "Avatar",
"basic": "Általános",
+ "browse": "Böngészés",
"calendar": "Naptár",
"cancel": "Mégsem",
"clear": "Törlés",
@@ -80,6 +81,7 @@
"explore": "Felfedezés",
"filter": "Szűrő",
"home": "Főoldal",
+ "timeline": "Idővonal",
"inbox": "Értesítések",
"language": "Nyelv",
"last-updated-at": "Utoljára frissítve",
@@ -977,12 +979,8 @@
"previous-year": "Előző év.",
"select-month": "Hónap kiválasztása."
},
- "profile": {
- "no-shared-memos": "@{{username}} még nem osztott meg feljegyzéseket.",
- "not-found-description": "Nincs Memos @{{username}} nevű felhasználó ezen a példányon.",
- "not-found-title": "Senki sincs itt"
- },
"space": {
+ "all-spaces": "Összes tér",
"icon": {
"change": "Tér ikonjának módosítása",
"kind": "Ikontípus",
diff --git a/web/src/locales/id.json b/web/src/locales/id.json
index 536195224..88d801217 100644
--- a/web/src/locales/id.json
+++ b/web/src/locales/id.json
@@ -54,6 +54,7 @@
"attachments": "Lampiran",
"avatar": "Avatar",
"basic": "Dasar",
+ "browse": "Telusuri",
"calendar": "Kalender",
"cancel": "Batal",
"clear": "Bersihkan",
@@ -80,6 +81,7 @@
"explore": "Jelajahi",
"filter": "Saring",
"home": "Beranda",
+ "timeline": "Linimasa",
"inbox": "Kotak Masuk",
"language": "Bahasa",
"last-updated-at": "Terakhir diperbarui pada",
@@ -963,11 +965,6 @@
"banner-title": "Demo Memos",
"deploy-link": "Sebarkan Memos Anda sendiri"
},
- "profile": {
- "no-shared-memos": "@{{username}} belum membagikan memo apa pun.",
- "not-found-description": "Tidak ada pengguna Memos bernama @{{username}} pada instance ini.",
- "not-found-title": "Tidak ada siapa pun di sini"
- },
"search": {
"access-error": "Anda tidak memiliki akses ke memo ini.",
"clear-query": "Hapus kueri",
@@ -983,6 +980,7 @@
"text": "Teks"
},
"space": {
+ "all-spaces": "Semua ruang",
"icon": {
"change": "Ubah ikon ruang",
"kind": "Jenis ikon",
diff --git a/web/src/locales/it.json b/web/src/locales/it.json
index f3ae211cd..a2016717f 100644
--- a/web/src/locales/it.json
+++ b/web/src/locales/it.json
@@ -54,6 +54,7 @@
"attachments": "Allegati",
"avatar": "Avatar",
"basic": "Base",
+ "browse": "Sfoglia",
"calendar": "Calendario",
"cancel": "Annulla",
"clear": "Pulisci",
@@ -80,6 +81,7 @@
"explore": "Esplora",
"filter": "Filtro",
"home": "Home",
+ "timeline": "Cronologia",
"inbox": "Notifiche",
"language": "Lingua",
"last-updated-at": "Ultimo aggiornamento",
@@ -977,12 +979,8 @@
"previous-year": "Anno precedente",
"select-month": "Seleziona il mese"
},
- "profile": {
- "no-shared-memos": "@{{username}} non ha ancora condiviso alcun memo.",
- "not-found-description": "Non esiste un utente di nome @{{username}} con Memos colonne in questa istanza.",
- "not-found-title": "Nessuno qui"
- },
"space": {
+ "all-spaces": "Tutti gli spazi",
"icon": {
"change": "Cambia icona dello spazio",
"kind": "Tipo di icona",
diff --git a/web/src/locales/ja.json b/web/src/locales/ja.json
index 80a288055..487fea956 100644
--- a/web/src/locales/ja.json
+++ b/web/src/locales/ja.json
@@ -55,6 +55,7 @@
"attachments": "添付ファイル",
"avatar": "アイコン",
"basic": "基本設定",
+ "browse": "閲覧",
"calendar": "カレンダー",
"cancel": "キャンセル",
"clear": "クリア",
@@ -81,6 +82,7 @@
"explore": "共有メモ",
"filter": "フィルター",
"home": "ホーム",
+ "timeline": "タイムライン",
"inbox": "受信トレイ",
"language": "言語",
"last-updated-at": "最終更新日時",
@@ -977,12 +979,8 @@
"previous-year": "前年",
"select-month": "月を選択"
},
- "profile": {
- "no-shared-memos": "@{{username}}はまだメモを共有していません。",
- "not-found-description": "このインスタンスには、@{{username}}という名前のMemosユーザーが存在しません。",
- "not-found-title": "ここには誰もいません"
- },
"space": {
+ "all-spaces": "すべてのスペース",
"icon": {
"change": "スペースアイコンの変更",
"kind": "アイコンの種類",
diff --git a/web/src/locales/ka-GE.json b/web/src/locales/ka-GE.json
index d70a5ab64..caa80744f 100644
--- a/web/src/locales/ka-GE.json
+++ b/web/src/locales/ka-GE.json
@@ -54,6 +54,7 @@
"attachments": "დანართები",
"avatar": "ავატარი",
"basic": "ძირითადი",
+ "browse": "დათვალიერება",
"calendar": "კალენდარი",
"cancel": "გაუქმება",
"clear": "გასუფთავება",
@@ -80,6 +81,7 @@
"explore": "კვლევა",
"filter": "ფილტრი",
"home": "მთავარი",
+ "timeline": "დროის ხაზი",
"inbox": "ინბოქსი",
"language": "ენა",
"last-updated-at": "ბოლო განახლება",
@@ -977,12 +979,8 @@
"previous-year": "წინა წელი",
"select-month": "თვის არჩევა"
},
- "profile": {
- "no-shared-memos": "@{{username}}-ს ჯერ არ გაუზიარებია არცერთი მემო.",
- "not-found-description": "ამ ინსტანციაში არ არის Memos მომხმარებელი სახელად @{{username}}.",
- "not-found-title": "აქ არავინაა"
- },
"space": {
+ "all-spaces": "ყველა სივრცე",
"icon": {
"change": "სივრცის ხატულას შეცვლა",
"kind": "ხატულას ტიპი",
diff --git a/web/src/locales/ko.json b/web/src/locales/ko.json
index 96b45e50f..b56597967 100644
--- a/web/src/locales/ko.json
+++ b/web/src/locales/ko.json
@@ -54,6 +54,7 @@
"attachments": "첨부파일",
"avatar": "아바타",
"basic": "기본",
+ "browse": "둘러보기",
"calendar": "달력",
"cancel": "취소",
"clear": "정리하기",
@@ -80,6 +81,7 @@
"explore": "탐색",
"filter": "필터",
"home": "홈",
+ "timeline": "타임라인",
"inbox": "알림함",
"language": "언어",
"last-updated-at": "마지막 수정일",
@@ -963,11 +965,6 @@
"banner-title": "Memos 데모",
"deploy-link": "Memos 직접 배포"
},
- "profile": {
- "no-shared-memos": "@{{username}}님은 아직 메모를 공유하지 않았습니다.",
- "not-found-description": "이 인스턴스에는 @{{username}}이라는 이름의 Memos 사용자가 없습니다.",
- "not-found-title": "여기에 아무도 없습니다."
- },
"search": {
"access-error": "이 메모에 대한 접근 권한이 없습니다.",
"clear-query": "쿼리 지우기",
@@ -983,6 +980,7 @@
"text": "텍스트"
},
"space": {
+ "all-spaces": "모든 스페이스",
"icon": {
"change": "공간 아이콘 변경",
"kind": "아이콘 유형",
diff --git a/web/src/locales/lt.json b/web/src/locales/lt.json
index 4dd3a0206..d784d4360 100644
--- a/web/src/locales/lt.json
+++ b/web/src/locales/lt.json
@@ -92,6 +92,7 @@
"attachments": "Priedai",
"avatar": "Avataras",
"basic": "Pagrindinis",
+ "browse": "Peržiūra",
"calendar": "Kalendorius",
"cancel": "Atšaukti",
"clear": "Aišku",
@@ -119,6 +120,7 @@
"explore": "Naršyti",
"filter": "Filtruoti",
"home": "Pradžia",
+ "timeline": "Laiko juosta",
"inbox": "Gautieji",
"language": "Kalba",
"last-updated-at": "Paskutinį kartą atnaujinta",
@@ -977,12 +979,8 @@
"previous-year": "Ankstesniais metais",
"select-month": "Pasirinkite mėnesį"
},
- "profile": {
- "no-shared-memos": "@{{username}} dar nebendrino jokių priminimų.",
- "not-found-description": "Šioje instancijoje nėra Memos vartotojo, vardu @{{username}}.",
- "not-found-title": "Čia nieko nėra"
- },
"space": {
+ "all-spaces": "Visos erdvės",
"icon": {
"change": "Keisti erdvės piktogramą",
"kind": "Piktogramos tipas",
diff --git a/web/src/locales/lv.json b/web/src/locales/lv.json
index 4e263291e..e9eb4efe2 100644
--- a/web/src/locales/lv.json
+++ b/web/src/locales/lv.json
@@ -92,6 +92,7 @@
"attachments": "Pielikumi",
"avatar": "Iemiesojums",
"basic": "Pamata",
+ "browse": "Pārlūkot",
"calendar": "Kalendārs",
"cancel": "Atcelt",
"clear": "Skaidrs",
@@ -119,6 +120,7 @@
"explore": "Izpētīt",
"filter": "Filtrs",
"home": "Sākums",
+ "timeline": "Laika skala",
"inbox": "Iesūtne",
"language": "Valoda",
"last-updated-at": "Pēdējo reizi atjaunināts plkst",
@@ -977,12 +979,8 @@
"previous-year": "Iepriekšējais gads",
"select-month": "Atlasīt mēnesi"
},
- "profile": {
- "no-shared-memos": "@{{username}} vēl nav kopīgojis nevienu piezīmi.",
- "not-found-description": "Šajā instancē nav neviena Memos lietotāja ar nosaukumu @{{username}}.",
- "not-found-title": "Šeit neviena nav"
- },
"space": {
+ "all-spaces": "Visas telpas",
"icon": {
"change": "Mainīt telpas ikonu",
"kind": "Ikonas veids",
diff --git a/web/src/locales/mr.json b/web/src/locales/mr.json
index 9b04115c2..ca5dafebb 100644
--- a/web/src/locales/mr.json
+++ b/web/src/locales/mr.json
@@ -54,6 +54,7 @@
"attachments": "संलग्नक",
"avatar": "अवतार",
"basic": "मूलभूत",
+ "browse": "ब्राउझ करा",
"calendar": "दिनदर्शिका",
"cancel": "रद्द करा",
"clear": "साफ",
@@ -80,6 +81,7 @@
"explore": "अन्वेषण",
"filter": "गाळा",
"home": "घर",
+ "timeline": "कालरेषा",
"inbox": "इनबॉक्स",
"language": "भाषा",
"last-updated-at": "शेवटचे अद्यतन",
@@ -963,11 +965,6 @@
"banner-title": "Memos डेमो",
"deploy-link": "तुमचे स्वतःचे Memos तैनात करा"
},
- "profile": {
- "no-shared-memos": "@{{username}} ने अद्याप कोणतेही मेमो शेअर केलेले नाहीत.",
- "not-found-description": "या इन्स्टन्सवर @{{username}} नावाचा कोणताही Memos वापरकर्ता नाही.",
- "not-found-title": "येथे कोणीही नाही"
- },
"search": {
"access-error": "तुम्हाला या मेमोंचा ॲक्सेस नाही.",
"clear-query": "क्वेरी साफ करा",
@@ -983,6 +980,7 @@
"text": "मजकूर"
},
"space": {
+ "all-spaces": "सर्व स्पेस",
"icon": {
"change": "स्पेस आयकॉन बदला",
"kind": "आयकॉनचा प्रकार",
diff --git a/web/src/locales/nb.json b/web/src/locales/nb.json
index 13b3f90cc..633eb0f35 100644
--- a/web/src/locales/nb.json
+++ b/web/src/locales/nb.json
@@ -54,6 +54,7 @@
"attachments": "Vedlegg",
"avatar": "Avatar",
"basic": "Grunnleggende",
+ "browse": "Bla gjennom",
"calendar": "Kalender",
"cancel": "Avbryt",
"clear": "Tøm",
@@ -80,6 +81,7 @@
"explore": "Utforsk",
"filter": "Filter",
"home": "Hjem",
+ "timeline": "Tidslinje",
"inbox": "Innboks",
"language": "Språk",
"last-updated-at": "Sist oppdatert",
@@ -977,12 +979,8 @@
"previous-year": "Forrige år",
"select-month": "Velg måned"
},
- "profile": {
- "no-shared-memos": "@{{username}} har ikke delt noen notater ennå.",
- "not-found-description": "Det finnes ingen Memos-bruker ved navn @{{username}} på denne instansen.",
- "not-found-title": "Ingen her"
- },
"space": {
+ "all-spaces": "Alle rom",
"icon": {
"change": "Endre romikon",
"kind": "Ikontype",
diff --git a/web/src/locales/nl.json b/web/src/locales/nl.json
index 5171fbd80..4c4eedbda 100644
--- a/web/src/locales/nl.json
+++ b/web/src/locales/nl.json
@@ -54,6 +54,7 @@
"attachments": "Bijlagen",
"avatar": "Avatar",
"basic": "Simpel",
+ "browse": "Bladeren",
"calendar": "Kalender",
"cancel": "Annuleren",
"clear": "Leegmaken",
@@ -80,6 +81,7 @@
"explore": "Verkennen",
"filter": "Filter",
"home": "Thuis",
+ "timeline": "Tijdlijn",
"inbox": "Postvak",
"language": "Taal",
"last-updated-at": "Laatst bijgewerkt op",
@@ -977,12 +979,8 @@
"previous-year": "Vorig jaar",
"select-month": "Selecteer maand"
},
- "profile": {
- "no-shared-memos": "@{{username}} heeft nog geen memo's gedeeld.",
- "not-found-description": "Er is geen Memos gebruiker met de naam @{{username}} op deze instantie.",
- "not-found-title": "Niemand hier"
- },
"space": {
+ "all-spaces": "Alle ruimtes",
"icon": {
"change": "Pictogram van de ruimte wijzigen",
"kind": "Type pictogram",
diff --git a/web/src/locales/pl.json b/web/src/locales/pl.json
index b7ba5066e..a6e968ee7 100644
--- a/web/src/locales/pl.json
+++ b/web/src/locales/pl.json
@@ -54,6 +54,7 @@
"attachments": "Załączniki",
"avatar": "Awatar",
"basic": "Podstawowy",
+ "browse": "Przeglądaj",
"calendar": "Kalendarz",
"cancel": "Anuluj",
"clear": "Wyczyść",
@@ -80,6 +81,7 @@
"explore": "Odkryj",
"filter": "Filtr",
"home": "Strona główna",
+ "timeline": "Oś czasu",
"inbox": "Skrzynka odbiorcza",
"language": "Język",
"last-updated-at": "Ostatnia aktualizacja",
@@ -977,12 +979,8 @@
"previous-year": "Poprzedni rok",
"select-month": "Wybierz miesiąc"
},
- "profile": {
- "no-shared-memos": "@{{username}} nie udostępnił jeszcze żadnych notatek.",
- "not-found-description": "Na tej instancji nie ma użytkownika Memos o nazwie @{{username}}.",
- "not-found-title": "Nikogo tu nie ma."
- },
"space": {
+ "all-spaces": "Wszystkie przestrzenie",
"icon": {
"change": "Zmień ikonę przestrzeni",
"kind": "Typ ikony",
diff --git a/web/src/locales/pt-BR.json b/web/src/locales/pt-BR.json
index 7e5c60c18..fd63917e2 100644
--- a/web/src/locales/pt-BR.json
+++ b/web/src/locales/pt-BR.json
@@ -54,6 +54,7 @@
"attachments": "Anexos",
"avatar": "Avatar",
"basic": "Básico",
+ "browse": "Navegar",
"calendar": "Calendário",
"cancel": "Cancelar",
"clear": "Limpar",
@@ -80,6 +81,7 @@
"explore": "Explorar",
"filter": "Filtro",
"home": "Início",
+ "timeline": "Linha do tempo",
"inbox": "Notificações",
"language": "Idioma",
"last-updated-at": "Atualizado em",
@@ -963,11 +965,6 @@
"banner-title": "Demonstração de Memos",
"deploy-link": "Implante seu próprio Memos"
},
- "profile": {
- "no-shared-memos": "@{{username}} ainda não compartilhou nenhum memorando.",
- "not-found-description": "Não existe nenhum usuário Memos chamado @{{username}} nesta instância.",
- "not-found-title": "Ninguém aqui."
- },
"search": {
"access-error": "Você não tem acesso a esses memorandos.",
"clear-query": "Limpar consulta",
@@ -983,6 +980,7 @@
"text": "Texto"
},
"space": {
+ "all-spaces": "Todos os espaços",
"icon": {
"change": "Alterar ícone do espaço",
"kind": "Tipo de ícone",
diff --git a/web/src/locales/pt-PT.json b/web/src/locales/pt-PT.json
index 24d6ea1b5..800ec5e1b 100644
--- a/web/src/locales/pt-PT.json
+++ b/web/src/locales/pt-PT.json
@@ -54,6 +54,7 @@
"attachments": "Anexos",
"avatar": "Avatar",
"basic": "Básico",
+ "browse": "Navegar",
"calendar": "Calendário",
"cancel": "Cancelar",
"clear": "Limpar",
@@ -80,6 +81,7 @@
"explore": "Explorar",
"filter": "Filtrar",
"home": "Início",
+ "timeline": "Linha do tempo",
"inbox": "Notificações",
"language": "Idioma",
"last-updated-at": "Última atualização em",
@@ -977,12 +979,8 @@
"previous-year": "Ano anterior",
"select-month": "Selecione o mês"
},
- "profile": {
- "no-shared-memos": "@{{username}} ainda não partilhou nenhum memorando.",
- "not-found-description": "Não existe nenhum utilizador Memos chamado @{{username}} nesta instância.",
- "not-found-title": "Ninguém aqui"
- },
"space": {
+ "all-spaces": "Todos os espaços",
"icon": {
"change": "Alterar ícone do espaço",
"kind": "Tipo de ícone",
diff --git a/web/src/locales/ro.json b/web/src/locales/ro.json
index 9415537f1..972e014e2 100644
--- a/web/src/locales/ro.json
+++ b/web/src/locales/ro.json
@@ -92,6 +92,7 @@
"attachments": "Atasamente",
"avatar": "Avatar",
"basic": "De bază",
+ "browse": "Răsfoiește",
"calendar": "Calendaristic",
"cancel": "Anula",
"clear": "Clar",
@@ -119,6 +120,7 @@
"explore": "Explora",
"filter": "Filtra",
"home": "Acasă",
+ "timeline": "Cronologie",
"inbox": "Inbox",
"language": "Limbă",
"last-updated-at": "Ultima actualizare la",
@@ -977,12 +979,8 @@
"previous-year": "Anul precedent",
"select-month": "Selectați luna"
},
- "profile": {
- "no-shared-memos": "@{{username}} nu a distribuit încă nicio notă.",
- "not-found-description": "Nu există niciun utilizator Memos numit @{{username}} pe această instanță.",
- "not-found-title": "Nu este nimeni aici"
- },
"space": {
+ "all-spaces": "Toate spațiile",
"icon": {
"change": "Schimbă pictograma spațiului",
"kind": "Tip pictogramă",
diff --git a/web/src/locales/ru.json b/web/src/locales/ru.json
index 8de75e481..3c7660945 100644
--- a/web/src/locales/ru.json
+++ b/web/src/locales/ru.json
@@ -54,6 +54,7 @@
"attachments": "Файлы",
"avatar": "Аватар",
"basic": "Базовые",
+ "browse": "Просмотр",
"calendar": "Календарь",
"cancel": "Отменить",
"clear": "Очистить",
@@ -80,6 +81,7 @@
"explore": "Обзор",
"filter": "Фильтр",
"home": "Главная",
+ "timeline": "Хронология",
"inbox": "Уведомления",
"language": "Язык",
"last-updated-at": "Изменено",
@@ -963,11 +965,6 @@
"previous-year": "Предыдущий год",
"select-month": "Выбрать месяц"
},
- "profile": {
- "no-shared-memos": "@{{username}} еще не поделился ни одной заметкой.",
- "not-found-description": "В этом экземпляре нет пользователя Memos с именем @{{username}}.",
- "not-found-title": "Здесь никого нет"
- },
"search": {
"access-error": "У вас нет доступа к этим заметкам.",
"clear-query": "Очистить запрос",
@@ -983,6 +980,7 @@
"text": "Текст"
},
"space": {
+ "all-spaces": "Все пространства",
"icon": {
"change": "Изменить значок пространства",
"kind": "Тип значка",
diff --git a/web/src/locales/sk.json b/web/src/locales/sk.json
index 90330c37b..765eea79a 100644
--- a/web/src/locales/sk.json
+++ b/web/src/locales/sk.json
@@ -92,6 +92,7 @@
"attachments": "Prílohy",
"avatar": "Avatar",
"basic": "Základné",
+ "browse": "Prehliadať",
"calendar": "Kalendár",
"cancel": "Zrušiť",
"clear": "Jasné",
@@ -119,6 +120,7 @@
"explore": "Preskúmajte",
"filter": "Filter",
"home": "Domov",
+ "timeline": "Časová os",
"inbox": "Doručená pošta",
"language": "Jazyk",
"last-updated-at": "Naposledy aktualizované o",
@@ -977,12 +979,8 @@
"previous-year": "Predchádzajúci rok",
"select-month": "Vyberte mesiac"
},
- "profile": {
- "no-shared-memos": "@{{username}} zatiaľ nezdieľa žiadne poznámky.",
- "not-found-description": "V tejto inštancii nie je žiadny používateľ Memos s menom @{{username}}.",
- "not-found-title": "Nikto tu nie je"
- },
"space": {
+ "all-spaces": "Všetky priestory",
"icon": {
"change": "Zmeniť ikonu priestoru",
"kind": "Typ ikony",
diff --git a/web/src/locales/sl.json b/web/src/locales/sl.json
index b6b17755e..42dc0fb6e 100644
--- a/web/src/locales/sl.json
+++ b/web/src/locales/sl.json
@@ -54,6 +54,7 @@
"attachments": "Priloge",
"avatar": "Avatar",
"basic": "Osnovni",
+ "browse": "Brskaj",
"calendar": "Koledar",
"cancel": "Prekliči",
"clear": "Počisti",
@@ -80,6 +81,7 @@
"explore": "Razišči",
"filter": "Filtriraj",
"home": "Domov",
+ "timeline": "Časovnica",
"inbox": "Prejeto",
"language": "Jezik",
"last-updated-at": "Zadnja posodobitev",
@@ -977,12 +979,8 @@
"previous-year": "Prejšnje leto",
"select-month": "Izberite mesec"
},
- "profile": {
- "no-shared-memos": "@{{username}} še ni delil nobenih zapiskov.",
- "not-found-description": "V tem primeru ni uporabnika Memos z imenom @{{username}}.",
- "not-found-title": "Nihče tukaj"
- },
"space": {
+ "all-spaces": "Vsi prostori",
"icon": {
"change": "Spremeni ikono prostora",
"kind": "Vrsta ikone",
diff --git a/web/src/locales/sr.json b/web/src/locales/sr.json
index af9e7cfce..7611dd047 100644
--- a/web/src/locales/sr.json
+++ b/web/src/locales/sr.json
@@ -92,6 +92,7 @@
"attachments": "Прилози",
"avatar": "Аватар",
"basic": "Басиц",
+ "browse": "Прегледај",
"calendar": "Календар",
"cancel": "Откажи",
"clear": "Јасно",
@@ -119,6 +120,7 @@
"explore": "Истражите",
"filter": "Филтер",
"home": "Хоме",
+ "timeline": "Временска линија",
"inbox": "Инбок",
"language": "Језик",
"last-updated-at": "Последњи пут ажурирано у",
@@ -977,12 +979,8 @@
"previous-year": "Претходна година",
"select-month": "Изаберите месец"
},
- "profile": {
- "no-shared-memos": "@{{username}} још није поделио ниједну поруку.",
- "not-found-description": "Нема корисника Memos по имену @{{username}} на овој инстанци.",
- "not-found-title": "Нико овде није доступан"
- },
"space": {
+ "all-spaces": "Сви простори",
"icon": {
"change": "Промени икону простора",
"kind": "Тип иконе",
diff --git a/web/src/locales/sv.json b/web/src/locales/sv.json
index fb0877803..3444abd23 100644
--- a/web/src/locales/sv.json
+++ b/web/src/locales/sv.json
@@ -54,6 +54,7 @@
"attachments": "Bilagor",
"avatar": "Profilbild",
"basic": "Grundläggande",
+ "browse": "Bläddra",
"calendar": "Kalender",
"cancel": "Avbryt",
"clear": "Rensa",
@@ -80,6 +81,7 @@
"explore": "Utforska",
"filter": "Filter",
"home": "Hem",
+ "timeline": "Tidslinje",
"inbox": "Inkorg",
"language": "Språk",
"last-updated-at": "Senast uppdaterad",
@@ -977,12 +979,8 @@
"previous-year": "Föregående år",
"select-month": "Välj månad"
},
- "profile": {
- "no-shared-memos": "@{{username}} har inte delat några PM än.",
- "not-found-description": "Det finns ingen Memos användare med namnet @{{username}} på den här instansen.",
- "not-found-title": "Ingen här"
- },
"space": {
+ "all-spaces": "Alla utrymmen",
"icon": {
"change": "Ändra utrymmesikon",
"kind": "Ikontyp",
diff --git a/web/src/locales/th.json b/web/src/locales/th.json
index e0489d071..d15a35ffb 100644
--- a/web/src/locales/th.json
+++ b/web/src/locales/th.json
@@ -54,6 +54,7 @@
"attachments": "ไฟล์แนบ",
"avatar": "สัญลักษณ์",
"basic": "ทั่วไป",
+ "browse": "เรียกดู",
"calendar": "ปฏิทิน",
"cancel": "ยกเลิก",
"clear": "ล้าง",
@@ -80,6 +81,7 @@
"explore": "สำรวจ",
"filter": "ตัวกรอง",
"home": "หน้าหลัก",
+ "timeline": "ไทม์ไลน์",
"inbox": "กล่องจดหมาย",
"language": "ภาษา",
"last-updated-at": "อัปเดตล่าสุดเมื่อ",
@@ -963,11 +965,6 @@
"banner-title": "Memos สาธิต",
"deploy-link": "ปรับใช้ Memos ของคุณเอง"
},
- "profile": {
- "no-shared-memos": "@{{username}} ยังไม่ได้แชร์บันทึกใดๆ",
- "not-found-description": "ไม่มีผู้ใช้ Memos ชื่อ @{{username}} ในอินสแตนซ์นี้",
- "not-found-title": "ไม่มีใครอยู่ที่นี่"
- },
"search": {
"access-error": "คุณไม่มีสิทธิ์เข้าถึงบันทึกเหล่านี้",
"clear-query": "ล้างคำค้นหา",
@@ -983,6 +980,7 @@
"text": "ข้อความ"
},
"space": {
+ "all-spaces": "พื้นที่ทั้งหมด",
"icon": {
"change": "เปลี่ยนไอคอนพื้นที่",
"kind": "ประเภทไอคอน",
diff --git a/web/src/locales/tr.json b/web/src/locales/tr.json
index 582bb53ec..f5ae1830f 100644
--- a/web/src/locales/tr.json
+++ b/web/src/locales/tr.json
@@ -80,6 +80,7 @@
"attachments": "Ekler",
"avatar": "Profil Resmi",
"basic": "Temel",
+ "browse": "Göz at",
"calendar": "Takvim",
"cancel": "İptal",
"clear": "Temizle",
@@ -108,6 +109,7 @@
"explore": "Keşfet",
"filter": "Filtrele",
"home": "Ana Sayfa",
+ "timeline": "Zaman çizelgesi",
"inbox": "Gelen Kutusu",
"language": "Dil",
"last-updated-at": "Son güncelleme",
@@ -361,11 +363,6 @@
"succeed-copy-link": "Bağlantı başarıyla kopyalandı.",
"update-succeed": "Güncelleme başarılı"
},
- "profile": {
- "no-shared-memos": "@{{username}} henüz hiç not paylaşmadı.",
- "not-found-description": "Bu sunucuda @{{username}} adında bir Memos kullanıcısı yok.",
- "not-found-title": "Burada kimse yok"
- },
"reference": {
"no-memos-found": "Not bulunamadı",
"search-placeholder": "İçerik ara"
@@ -908,6 +905,7 @@
}
},
"space": {
+ "all-spaces": "Tüm alanlar",
"icon": {
"change": "Alan simgesini değiştir",
"kind": "Simge türü",
diff --git a/web/src/locales/uk.json b/web/src/locales/uk.json
index 5ca1944be..28bed0b49 100644
--- a/web/src/locales/uk.json
+++ b/web/src/locales/uk.json
@@ -54,6 +54,7 @@
"attachments": "Вкладення",
"avatar": "Аватар",
"basic": "Основний",
+ "browse": "Перегляд",
"calendar": "Календар",
"cancel": "Скасувати",
"clear": "Очистити",
@@ -80,6 +81,7 @@
"explore": "Дослідити",
"filter": "Фільтр",
"home": "Головна",
+ "timeline": "Хронологія",
"inbox": "Вхідні",
"language": "Мова",
"last-updated-at": "Останнє оновлення",
@@ -977,12 +979,8 @@
"previous-year": "Попередній рік",
"select-month": "Виберіть місяць"
},
- "profile": {
- "no-shared-memos": "@{{username}} ще не поділився жодними нотатками.",
- "not-found-description": "У цьому екземплярі немає користувача Memos з ім'ям @{{username}}.",
- "not-found-title": "Тут нікого немає"
- },
"space": {
+ "all-spaces": "Усі простори",
"icon": {
"change": "Змінити значок простору",
"kind": "Тип значка",
diff --git a/web/src/locales/vi.json b/web/src/locales/vi.json
index c4b9ff6fe..9fed9f176 100644
--- a/web/src/locales/vi.json
+++ b/web/src/locales/vi.json
@@ -54,6 +54,7 @@
"attachments": "Tệp đính kèm",
"avatar": "Ảnh đại diện",
"basic": "Cơ bản",
+ "browse": "Duyệt xem",
"calendar": "Lịch",
"cancel": "Hủy",
"clear": "Xóa",
@@ -80,6 +81,7 @@
"explore": "Khám phá",
"filter": "Lọc",
"home": "Trang chủ",
+ "timeline": "Dòng thời gian",
"inbox": "Hộp thư đến",
"language": "Ngôn ngữ",
"last-updated-at": "Cập nhật lần cuối",
@@ -963,11 +965,6 @@
"banner-title": "Bản demo Memos",
"deploy-link": "Triển khai Memos của riêng bạn"
},
- "profile": {
- "no-shared-memos": "@{{username}} chưa chia sẻ bất kỳ ghi chú nào.",
- "not-found-description": "Không có người dùng Memos nào có tên @{{username}} trên phiên bản này.",
- "not-found-title": "Không có ai ở đây"
- },
"search": {
"access-error": "Bạn không có quyền truy cập vào các bản ghi nhớ này.",
"clear-query": "Xóa truy vấn",
@@ -983,6 +980,7 @@
"text": "Văn bản"
},
"space": {
+ "all-spaces": "Tất cả không gian",
"icon": {
"change": "Thay đổi biểu tượng không gian",
"kind": "Loại biểu tượng",
diff --git a/web/src/locales/zh-Hans.json b/web/src/locales/zh-Hans.json
index 87601e75e..7af3a3e38 100644
--- a/web/src/locales/zh-Hans.json
+++ b/web/src/locales/zh-Hans.json
@@ -85,6 +85,7 @@
"attachments": "附件",
"avatar": "头像",
"basic": "基础",
+ "browse": "浏览",
"calendar": "日历",
"cancel": "取消",
"clear": "清除",
@@ -114,6 +115,7 @@
"explore": "发现",
"filter": "过滤器",
"home": "主页",
+ "timeline": "时间线",
"inbox": "通知",
"language": "语言",
"last-updated-at": "最后更新时间",
@@ -964,6 +966,7 @@
}
},
"space": {
+ "all-spaces": "所有空间",
"icon": {
"change": "更改空间图标",
"kind": "图标类型",
@@ -1008,10 +1011,5 @@
"mode": "搜索模式",
"syntax-help": "搜索语法",
"text": "文本"
- },
- "profile": {
- "no-shared-memos": "@{{username}} 尚未分享任何备忘录。",
- "not-found-description": "此实例中不存在名为 @{{username}} 的 Memos 用户。",
- "not-found-title": "未找到用户"
}
}
diff --git a/web/src/locales/zh-Hant.json b/web/src/locales/zh-Hant.json
index d2177c785..9eeb6b842 100644
--- a/web/src/locales/zh-Hant.json
+++ b/web/src/locales/zh-Hant.json
@@ -133,6 +133,7 @@
"attachments": "附件",
"avatar": "頭像",
"basic": "基礎",
+ "browse": "瀏覽",
"calendar": "日曆",
"cancel": "取消",
"clear": "清除",
@@ -160,6 +161,7 @@
"explore": "探索",
"filter": "篩選",
"home": "首頁",
+ "timeline": "時間軸",
"inbox": "通知",
"language": "語言",
"last-updated-at": "最後更新於",
@@ -942,6 +944,7 @@
}
},
"space": {
+ "all-spaces": "所有空間",
"unavailable": "空間不存在或你沒有存取權限。",
"back-to-memos": "返回 Memos",
"create": "建立空間",
@@ -1008,10 +1011,5 @@
"new-here": "在此記錄",
"saved-outside-filter": "已儲存。此備忘錄不在目前的地圖結果中。",
"open-memo": "開啟備忘錄"
- },
- "profile": {
- "no-shared-memos": "@{{username}} 尚未分享任何備忘錄。",
- "not-found-description": "此實例中沒有名為 @{{username}} 的 Memos 使用者。",
- "not-found-title": "找不到使用者"
}
}
diff --git a/web/src/main.tsx b/web/src/main.tsx
index 244e38e72..508ae1942 100644
--- a/web/src/main.tsx
+++ b/web/src/main.tsx
@@ -12,7 +12,6 @@ import { TooltipProvider } from "@/components/ui/tooltip";
import { refreshAccessToken } from "@/connect";
import { AuthProvider, useAuth } from "@/contexts/AuthContext";
import { InstanceProvider, useInstance } from "@/contexts/InstanceContext";
-import { ViewProvider } from "@/contexts/ViewContext";
import { useLiveMemoRefresh } from "@/hooks/useLiveMemoRefresh";
import { useTokenRefreshOnFocus } from "@/hooks/useTokenRefreshOnFocus";
import { queryClient } from "@/lib/query-client";
@@ -66,20 +65,18 @@ function Main() {
<InstanceProvider>
<AuthProvider>
<TooltipProvider>
- <ViewProvider>
- <AppInitializer>
- <RouterProvider router={router} />
- <Toaster
- position="top-right"
- toastOptions={{
- style: {
- background: "var(--popover)",
- color: "var(--popover-foreground)",
- },
- }}
- />
- </AppInitializer>
- </ViewProvider>
+ <AppInitializer>
+ <RouterProvider router={router} />
+ <Toaster
+ position="top-right"
+ toastOptions={{
+ style: {
+ background: "var(--popover)",
+ color: "var(--popover-foreground)",
+ },
+ }}
+ />
+ </AppInitializer>
</TooltipProvider>
</AuthProvider>
</InstanceProvider>
diff --git a/web/src/pages/Attachments.tsx b/web/src/pages/Attachments.tsx
index 59305cee2..ad2d01d3f 100644
--- a/web/src/pages/Attachments.tsx
+++ b/web/src/pages/Attachments.tsx
@@ -1,6 +1,6 @@
import { create } from "@bufbuild/protobuf";
import { LoaderCircleIcon, Trash2Icon } from "lucide-react";
-import { useEffect, useState } from "react";
+import { useEffect, useMemo, useState } from "react";
import { toast } from "react-hot-toast";
import {
AttachmentAudioRows,
@@ -19,7 +19,9 @@ import { useAppSidebar } from "@/contexts/AppSidebarContext";
import { useSpaceContext } from "@/contexts/SpaceContext";
import { useAttachmentLibrary, useUnusedAttachmentLibrary } from "@/hooks/useAttachmentLibrary";
import { useBatchDeleteAttachments } from "@/hooks/useAttachmentQueries";
+import useCurrentUser from "@/hooks/useCurrentUser";
import useDialog from "@/hooks/useDialog";
+import { useUsersByNames } from "@/hooks/useUserQueries";
import i18n from "@/i18n";
import { combineCELFilters } from "@/lib/cel-filter";
import { handleError } from "@/lib/error";
@@ -65,9 +67,11 @@ const listUnusedAttachmentNames = async (filter: string | undefined, selectedSpa
const Attachments = () => {
const t = useTranslate();
+ const currentUser = useCurrentUser();
const deleteUnusedAttachmentsDialog = useDialog();
const { attachmentSection, setAttachmentSection } = useAppSidebar();
- const { memoFilter, selectedSpaceName } = useSpaceContext();
+ const { memoFilter, selectedSpaceName, creatorUsername } = useSpaceContext();
+ const canShowUnused = !selectedSpaceName && (!creatorUsername || creatorUsername === currentUser?.username);
const [previewState, setPreviewState] = useState({ open: false, initialIndex: 0 });
const { mutateAsync: batchDeleteAttachments, isPending: isDeletingUnused } = useBatchDeleteAttachments();
const {
@@ -92,13 +96,28 @@ const Attachments = () => {
isLoading: unusedIsLoading,
refetch: refetchUnused,
unusedItems: completeUnusedItems,
- } = useUnusedAttachmentLibrary(i18n.language, memoFilter, attachmentSection === "unused" && !selectedSpaceName);
+ } = useUnusedAttachmentLibrary(i18n.language, memoFilter, attachmentSection === "unused" && canShowUnused);
+ const creatorNames = useMemo(
+ () =>
+ Array.from(
+ new Set(
+ [
+ ...mediaGroups.flatMap((group) => group.items.map((item) => item.primaryAttachment.creator)),
+ ...documentItems.map((item) => item.attachment.creator),
+ ...audioItems.map((item) => item.attachment.creator),
+ ...completeUnusedItems.map((item) => item.attachment.creator),
+ ].filter(Boolean),
+ ),
+ ),
+ [mediaGroups, documentItems, audioItems, completeUnusedItems],
+ );
+ const { data: creators } = useUsersByNames(creatorNames);
useEffect(() => {
- if (selectedSpaceName && attachmentSection === "unused") {
+ if (!canShowUnused && attachmentSection === "unused") {
setAttachmentSection("all");
}
- }, [attachmentSection, selectedSpaceName, setAttachmentSection]);
+ }, [attachmentSection, canShowUnused, setAttachmentSection]);
const handlePreview = (itemId: string) => {
const initialIndex = mediaPreviewItems.findIndex((item) => item.id === itemId);
@@ -159,7 +178,7 @@ const Attachments = () => {
{t("resource.delete-all-unused")}
</Button>
</div>
- <AttachmentUnusedRows items={completeUnusedItems} />
+ <AttachmentUnusedRows items={completeUnusedItems} creators={creators} />
</div>
);
}
@@ -180,19 +199,19 @@ const Attachments = () => {
{stats.media > 0 && (
<section className="space-y-3">
<h2 className="text-sm font-medium text-foreground">{t("attachment-library.tabs.media")}</h2>
- <AttachmentMediaGrid groups={mediaGroups} onPreview={handlePreview} />
+ <AttachmentMediaGrid groups={mediaGroups} creators={creators} onPreview={handlePreview} />
</section>
)}
{stats.documents > 0 && (
<section className="space-y-3">
<h2 className="text-sm font-medium text-foreground">{t("attachment-library.tabs.documents")}</h2>
- <AttachmentDocumentRows items={documentItems} />
+ <AttachmentDocumentRows items={documentItems} creators={creators} />
</section>
)}
{stats.audio > 0 && (
<section className="space-y-3">
<h2 className="text-sm font-medium text-foreground">{t("attachment-library.tabs.audio")}</h2>
- <AttachmentAudioRows items={audioItems} />
+ <AttachmentAudioRows items={audioItems} creators={creators} />
</section>
)}
</div>
@@ -201,17 +220,17 @@ const Attachments = () => {
if (attachmentSection === "media") {
if (stats.media === 0) return <AttachmentLibraryEmptyState tab="media" />;
- return <AttachmentMediaGrid groups={mediaGroups} onPreview={handlePreview} />;
+ return <AttachmentMediaGrid groups={mediaGroups} creators={creators} onPreview={handlePreview} />;
}
if (attachmentSection === "documents") {
if (stats.documents === 0) return <AttachmentLibraryEmptyState tab="documents" />;
- return <AttachmentDocumentRows items={documentItems} />;
+ return <AttachmentDocumentRows items={documentItems} creators={creators} />;
}
if (attachmentSection === "audio") {
if (stats.audio === 0) return <AttachmentLibraryEmptyState tab="audio" />;
- return <AttachmentAudioRows items={audioItems} />;
+ return <AttachmentAudioRows items={audioItems} creators={creators} />;
}
return null;
diff --git a/web/src/pages/Explore.tsx b/web/src/pages/Explore.tsx
deleted file mode 100644
index c6a302519..000000000
--- a/web/src/pages/Explore.tsx
+++ /dev/null
@@ -1,45 +0,0 @@
-import MemoView from "@/components/MemoView";
-import PagedMemoList, { getMemoKey } from "@/components/PagedMemoList";
-import { useSpaceContext } from "@/contexts/SpaceContext";
-import { useMemoFilters, useMemoSorting } from "@/hooks";
-import useCurrentUser from "@/hooks/useCurrentUser";
-import { State } from "@/types/proto/api/v1/common_pb";
-import { Memo, Visibility } from "@/types/proto/api/v1/memo_service_pb";
-
-const Explore = () => {
- const currentUser = useCurrentUser();
- const { memoFilter: contextFilter, selectedSpaceName } = useSpaceContext();
-
- // Determine visibility filter based on authentication status
- // - Logged-in users: Can see every audience the backend authorizes, including SPACE memos
- // - Visitors: Can only see PUBLIC memos
- // Note: The backend is responsible for filtering stats based on visibility permissions.
- const visibilities = currentUser ? [Visibility.PUBLIC, Visibility.PROTECTED, Visibility.SPACE] : [Visibility.PUBLIC];
-
- const memoFilter = useMemoFilters({
- includeMemoViews: true,
- includePinned: false,
- visibilities,
- });
-
- // Get sorting logic using unified hook (no pinned sorting)
- const { listSort, orderBy } = useMemoSorting({
- pinnedFirst: false,
- state: State.NORMAL,
- });
-
- return (
- <PagedMemoList
- renderer={(memo: Memo, { compact }) => (
- <MemoView key={getMemoKey(memo)} memo={memo} showCreator showVisibility showSpace={!selectedSpaceName} compact={compact} />
- )}
- listSort={listSort}
- orderBy={orderBy}
- filter={memoFilter}
- contextFilter={contextFilter}
- showCreator
- />
- );
-};
-
-export default Explore;
diff --git a/web/src/pages/Home.tsx b/web/src/pages/Home.tsx
index 4d4abade9..b9ebe44a9 100644
--- a/web/src/pages/Home.tsx
+++ b/web/src/pages/Home.tsx
@@ -23,17 +23,17 @@ const Home = () => {
const { isUserSettingsInitialized } = useAuth();
const { claimHomeAutoFocus } = useGlobalMemoEditor();
const { filters } = useMemoFilterContext();
- const { memoFilter: contextFilter, selectedSpaceName } = useSpaceContext();
+ const { memoFilter: contextFilter, selectedSpaceName, creatorUsername } = useSpaceContext();
const defaultCreateTime = useMemo(() => deriveDefaultCreateTimeFromFilters(filters), [filters]);
// Doubles as the remount key: the draft cache only reloads on mount, so the editor
// has to be rebuilt for the new Space rather than just re-pointed at another cache.
const editorCacheKey = spaceScopedCacheKey("home-memo-editor", selectedSpaceName);
const memoFilter = useMemoFilters({
- creatorName: user?.name,
includeMemoViews: true,
includePinned: true,
});
+ const canComposeInScope = Boolean(user && (!creatorUsername || creatorUsername === user.username));
const { listSort, orderBy } = useMemoSorting({
pinnedFirst: true,
@@ -45,14 +45,22 @@ const Home = () => {
<NewMemoProvider>
<PagedMemoList
renderer={(memo: Memo, { compact }) => (
- <MemoView key={getMemoKey(memo)} memo={memo} showVisibility showPinned showSpace={!selectedSpaceName} compact={compact} />
+ <MemoView
+ key={getMemoKey(memo)}
+ memo={memo}
+ showCreator={!creatorUsername}
+ showVisibility
+ showPinned
+ showSpace={!selectedSpaceName}
+ compact={compact}
+ />
)}
listSort={listSort}
orderBy={orderBy}
filter={memoFilter}
contextFilter={contextFilter}
renderLeading={({ useGrid }) => {
- if (!isUserSettingsInitialized) return null;
+ if (!isUserSettingsInitialized || !canComposeInScope) return null;
return (
<MemoEditor
diff --git a/web/src/pages/UserProfile.tsx b/web/src/pages/UserProfile.tsx
deleted file mode 100644
index 598bae22d..000000000
--- a/web/src/pages/UserProfile.tsx
+++ /dev/null
@@ -1,119 +0,0 @@
-import { UserRoundIcon } from "lucide-react";
-import { type ReactNode } from "react";
-import { Link, useParams } from "react-router-dom";
-import MemoView from "@/components/MemoView";
-import PagedMemoList, { getMemoKey } from "@/components/PagedMemoList";
-import UserAvatar from "@/components/UserAvatar";
-import { useMemoFilters, useMemoSorting } from "@/hooks";
-import useCurrentUser from "@/hooks/useCurrentUser";
-import { useDelayedFlag } from "@/hooks/useDelayedFlag";
-import { useUser } from "@/hooks/useUserQueries";
-import { LOADING_INDICATOR_DELAY_MS } from "@/lib/constants";
-import { userNamePrefix } from "@/lib/resource-names";
-import { cn } from "@/lib/utils";
-import { ROUTES } from "@/router/routes";
-import { State } from "@/types/proto/api/v1/common_pb";
-import { Memo } from "@/types/proto/api/v1/memo_service_pb";
-import type { User } from "@/types/proto/api/v1/user_service_pb";
-import { useTranslate } from "@/utils/i18n";
-
-const PROFILE_TITLE_CLASSES = "text-xl font-semibold leading-7 tracking-[-0.01em] text-foreground";
-const PROFILE_AVATAR_SLOT_CLASSES = "mt-0.5 size-10 shrink-0 rounded-lg";
-
-// The identity block sits on the content rail like everything else on the page: a 40px
-// avatar slot beside a text column. The loaded, loading and not-found states all share
-// this shell so they occupy the same space and swap without a jump.
-const IdentityRow = ({ avatar, className, children }: { avatar: ReactNode; className?: string; children: ReactNode }) => (
- <div className={cn("flex w-full items-start gap-3", className)}>
- {avatar}
- <div className="min-w-0 flex-1">{children}</div>
- </div>
-);
-
-// The list's header, so in grid mode it spans every column.
-const ProfileHeader = ({ user, className }: { user: User; className?: string }) => (
- <IdentityRow className={className} avatar={<UserAvatar className={PROFILE_AVATAR_SLOT_CLASSES} avatarUrl={user.avatarUrl} />}>
- <div className="flex min-w-0 flex-wrap items-baseline gap-x-2">
- <h1 className={cn("truncate", PROFILE_TITLE_CLASSES)}>{user.displayName || user.username}</h1>
- {user.displayName && <span className="text-ui text-muted-foreground">@{user.username}</span>}
- </div>
- {user.description && <p className="mt-0.5 line-clamp-2 max-w-[60ch] text-ui text-muted-foreground">{user.description}</p>}
- </IdentityRow>
-);
-
-const ProfileHeaderSkeleton = () => (
- <div aria-busy="true">
- <IdentityRow avatar={<span className={cn(PROFILE_AVATAR_SLOT_CLASSES, "animate-pulse bg-muted")} />}>
- <span className="mt-1 block h-5 w-40 animate-pulse rounded bg-muted" />
- <span className="mt-2 block h-3.5 w-3/5 animate-pulse rounded bg-muted" />
- </IdentityRow>
- </div>
-);
-
-const ProfileNotFound = ({ username }: { username: string }) => {
- const t = useTranslate();
- return (
- <IdentityRow
- avatar={
- <span
- className={cn(PROFILE_AVATAR_SLOT_CLASSES, "grid place-items-center border border-dashed border-input text-muted-foreground/60")}
- >
- <UserRoundIcon className="size-5" strokeWidth={1.6} />
- </span>
- }
- >
- <h1 className={PROFILE_TITLE_CLASSES}>{t("profile.not-found-title")}</h1>
- <p className="mt-0.5 max-w-[60ch] text-ui text-muted-foreground">{t("profile.not-found-description", { username })}</p>
- <Link to={ROUTES.EXPLORE} className="mt-3 block w-fit text-ui text-primary hover:underline">
- {t("common.explore")}
- </Link>
- </IdentityRow>
- );
-};
-
-const UserProfile = () => {
- const t = useTranslate();
- const username = useParams().username ?? "";
- const currentUser = useCurrentUser();
-
- const { data: user, isLoading } = useUser(`${userNamePrefix}${username}`, { enabled: !!username });
- const showSkeleton = useDelayedFlag(isLoading, LOADING_INDICATOR_DELAY_MS);
-
- const memoFilter = useMemoFilters({
- creatorName: user?.name,
- includeMemoViews: true,
- includePinned: true,
- });
-
- const { listSort, orderBy } = useMemoSorting({
- pinnedFirst: true,
- state: State.NORMAL,
- });
-
- if (user) {
- // Visitors only see what the backend lets them see, so an empty list means nothing
- // shared rather than nothing written. The owner sees everything and gets the default.
- const isOwner = currentUser?.name === user.name;
- return (
- <PagedMemoList
- renderer={(memo: Memo, { compact }) => (
- <MemoView key={getMemoKey(memo)} memo={memo} showVisibility showPinned showSpace compact={compact} />
- )}
- listSort={listSort}
- orderBy={orderBy}
- filter={memoFilter}
- emptyMessage={isOwner ? undefined : t("profile.no-shared-memos", { username: user.username })}
- renderHeader={({ useGrid }) => <ProfileHeader user={user} className={useGrid ? undefined : "mb-4"} />}
- />
- );
- }
-
- // Everything that is not the list shares the list's single-column reading rail.
- return (
- <section className="mx-auto flex w-full max-w-2xl flex-col gap-4">
- {isLoading ? showSkeleton && <ProfileHeaderSkeleton /> : <ProfileNotFound username={username} />}
- </section>
- );
-};
-
-export default UserProfile;
diff --git a/web/src/router/LegacyProfileRedirect.tsx b/web/src/router/LegacyProfileRedirect.tsx
new file mode 100644
index 000000000..544278b65
--- /dev/null
+++ b/web/src/router/LegacyProfileRedirect.tsx
@@ -0,0 +1,9 @@
+import { Navigate, useLocation, useParams } from "react-router-dom";
+import { ROUTES, withCollectionCreator } from "./routes";
+
+/** Keep existing author links usable while Home owns creator scope. */
+export const LegacyProfileRedirect = () => {
+ const { username } = useParams<{ username: string }>();
+ const location = useLocation();
+ return <Navigate to={{ pathname: ROUTES.HOME, search: withCollectionCreator(location.search, username), hash: location.hash }} replace />;
+};
diff --git a/web/src/router/guards.tsx b/web/src/router/guards.tsx
index 99dda521f..beca58d4c 100644
--- a/web/src/router/guards.tsx
+++ b/web/src/router/guards.tsx
@@ -18,32 +18,6 @@ export const RequireFullInitializationRoute = () => {
return authInitialized && instanceInitialized ? <Outlet /> : null;
};
-/**
- * Index-route gate mounted at `/`. Authenticated visitors fall through to the
- * nested Home page; unauthenticated visitors are redirected to `/explore`,
- * preserving the original query string and hash so bookmarks like `/?filter=foo`
- * keep working.
- */
-export const LandingRoute = () => {
- const currentUser = useCurrentUser();
- const location = useLocation();
-
- if (!currentUser) {
- return (
- <Navigate
- to={{
- pathname: ROUTES.EXPLORE,
- search: location.search,
- hash: location.hash,
- }}
- replace
- />
- );
- }
-
- return <Outlet />;
-};
-
/**
* Guard for routes that require an authenticated user. Unauthenticated visitors
* are redirected to `/auth` with the original location preserved as the `redirect`
diff --git a/web/src/router/index.tsx b/web/src/router/index.tsx
index 81b61a1e5..e8eb44504 100644
--- a/web/src/router/index.tsx
+++ b/web/src/router/index.tsx
@@ -1,17 +1,14 @@
-import { createBrowserRouter, Navigate, type RouteObject } from "react-router-dom";
+import { createBrowserRouter, Navigate, type RouteObject, useLocation } from "react-router-dom";
import App from "@/App";
import { ChunkLoadErrorFallback } from "@/components/ErrorBoundary";
+import { useAuth } from "@/contexts/AuthContext";
+import useCurrentUser from "@/hooks/useCurrentUser";
import MainLayout from "@/layouts/MainLayout";
import RootLayout from "@/layouts/RootLayout";
import { lazyWithReload } from "@/utils/lazy";
-import {
- LandingRoute,
- RequireAuthRoute,
- RequireFullInitializationRoute,
- RequireGuestRoute,
- RequireInstanceInitializationRoute,
-} from "./guards";
-import { CALENDAR_ROUTE_PATTERN, ROUTES, SPACE_ROUTE_PATTERN } from "./routes";
+import { RequireAuthRoute, RequireFullInitializationRoute, RequireGuestRoute, RequireInstanceInitializationRoute } from "./guards";
+import { LegacyProfileRedirect } from "./LegacyProfileRedirect";
+import { CALENDAR_ROUTE_PATTERN, getCollectionCreator, ROUTES, SPACE_ROUTE_PATTERN, withCollectionCreator } from "./routes";
import { SpaceRoute } from "./SpaceRoute";
const AdminSignIn = lazyWithReload(() => import("@/pages/AdminSignIn"));
@@ -20,7 +17,6 @@ const Archived = lazyWithReload(() => import("@/pages/Archived"));
const AuthCallback = lazyWithReload(() => import("@/pages/AuthCallback"));
const MemoMap = lazyWithReload(() => import("@/pages/Map"));
const Calendar = lazyWithReload(() => import("@/pages/Calendar"));
-const Explore = lazyWithReload(() => import("@/pages/Explore"));
const Home = lazyWithReload(() => import("@/pages/Home"));
const Inboxes = lazyWithReload(() => import("@/pages/Inboxes"));
const MemoDetail = lazyWithReload(() => import("@/pages/MemoDetail"));
@@ -31,7 +27,24 @@ const Setting = lazyWithReload(() => import("@/pages/Setting"));
const MemoViews = lazyWithReload(() => import("@/pages/MemoViews"));
const SignIn = lazyWithReload(() => import("@/pages/SignIn"));
const SignUp = lazyWithReload(() => import("@/pages/SignUp"));
-const UserProfile = lazyWithReload(() => import("@/pages/UserProfile"));
+
+const HomeRoute = () => {
+ const { isIdentityInitialized } = useAuth();
+ const currentUser = useCurrentUser();
+ const location = useLocation();
+ if (!isIdentityInitialized) return null;
+ if (!currentUser && !getCollectionCreator(location.search)) {
+ return <Navigate to={{ pathname: ROUTES.EXPLORE, search: location.search, hash: location.hash }} replace />;
+ }
+ return <Home />;
+};
+
+const ExploreRoute = () => {
+ const location = useLocation();
+ const search = withCollectionCreator(location.search);
+ if (search !== location.search) return <Navigate to={{ pathname: location.pathname, search, hash: location.hash }} replace />;
+ return <Home />;
+};
// Backward compatibility alias.
export const Routes = ROUTES;
@@ -78,16 +91,13 @@ export const routeConfig: RouteObject[] = [
{
element: <MainLayout />,
children: [
- {
- element: <LandingRoute />,
- children: [{ index: true, element: <Home /> }],
- },
+ { index: true, element: <HomeRoute /> },
{
element: <RequireInstanceInitializationRoute />,
children: [{ path: Routes.ABOUT, element: <About /> }],
},
- { path: Routes.EXPLORE, element: <Explore /> },
- { path: Routes.USER_PROFILE, element: <UserProfile /> },
+ { path: Routes.EXPLORE, element: <ExploreRoute /> },
+ { path: Routes.USER_PROFILE, element: <LegacyProfileRedirect /> },
{
element: <RequireAuthRoute />,
children: [
@@ -118,8 +128,8 @@ export const routeConfig: RouteObject[] = [
{
element: <MainLayout />,
children: [
- { index: true, element: <Home /> },
- { path: "explore", element: <Explore /> },
+ { index: true, element: <HomeRoute /> },
+ { path: "explore", element: <ExploreRoute /> },
{ path: "calendar/:year?/:month?/:day?", element: <Calendar /> },
],
},
diff --git a/web/src/router/routes.ts b/web/src/router/routes.ts
index 627f25ec9..a8cf74eb0 100644
--- a/web/src/router/routes.ts
+++ b/web/src/router/routes.ts
@@ -66,6 +66,66 @@ export const buildCollectionPath = (pathname: string, spaceName?: string): strin
export const collectionPathForLocation = (pathname: string, currentPath: string): string =>
buildCollectionPath(pathname, resolveCollectionRoute(currentPath).spaceName);
+/** An explicit creator is a URL-owned collection filter, independent of the selected Space. */
+export const getCollectionCreator = (search: string): string | undefined => {
+ const username = new URLSearchParams(search).get("creator");
+ return username || undefined;
+};
+
+export const withCollectionCreator = (search: string, username?: string): string => {
+ const params = new URLSearchParams(search);
+ if (username) params.set("creator", username);
+ else params.delete("creator");
+ const query = params.toString();
+ return query ? `?${query}` : "";
+};
+
+/** The canonical all-Space collection for one creator. */
+export const getCreatorHomePath = (username: string): string => `${ROUTES.HOME}${withCollectionCreator("", username)}`;
+
+/** Home is personal; Explore is all readable creators. Other collection views keep explicit creator filters. */
+export const getCollectionHomePath = (location: { pathname: string; search: string }): string => {
+ const route = resolveCollectionRoute(location.pathname);
+ const home =
+ route.pathname === ROUTES.EXPLORE || (route.isCollection && route.pathname !== ROUTES.HOME && !getCollectionCreator(location.search))
+ ? ROUTES.EXPLORE
+ : ROUTES.HOME;
+ return buildCollectionPath(home, route.spaceName);
+};
+
+/** Carries creator scope and collection filters between views, excluding view-specific query state. */
+export const collectionNavigationPath = (
+ pathname: string,
+ location: { pathname: string; search: string },
+ currentUsername?: string,
+): string => {
+ const route = resolveCollectionRoute(location.pathname);
+ const creator =
+ route.pathname === ROUTES.EXPLORE
+ ? undefined
+ : ((route.isCollection ? getCollectionCreator(location.search) : undefined) ??
+ (!route.isCollection || route.pathname === ROUTES.HOME ? currentUsername : undefined));
+ const filter = route.isCollection ? new URLSearchParams(location.search).get("filter") : null;
+ const search = filter ? new URLSearchParams({ filter }).toString() : "";
+ if (pathname === ROUTES.HOME) {
+ return `${getCollectionHomePath(location)}${withCollectionCreator(search, creator === currentUsername ? undefined : creator)}`;
+ }
+ return `${collectionPathForLocation(pathname, location.pathname)}${withCollectionCreator(search, creator)}`;
+};
+
+/** A creator change keeps the current collection view and Space. */
+export const getCreatorSwitchPath = (
+ location: { pathname: string; search: string; hash?: string },
+ username?: string,
+ currentUsername?: string,
+): string => {
+ const route = resolveCollectionRoute(location.pathname);
+ const isMemoList = route.pathname === ROUTES.HOME || route.pathname === ROUTES.EXPLORE || !route.isCollection;
+ const pathname = isMemoList ? buildCollectionPath(username ? ROUTES.HOME : ROUTES.EXPLORE, route.spaceName) : location.pathname;
+ const creator = username === currentUsername && isMemoList ? undefined : username;
+ return `${pathname}${withCollectionCreator(location.search, creator)}${location.hash || ""}`;
+};
+
/** Switching preserves collection views and their query; other pages start at Home. */
export const getSpaceSwitchPath = (location: { pathname: string; search: string; hash?: string }, spaceName?: string): string => {
const route = resolveCollectionRoute(location.pathname);
diff --git a/web/src/types/proto/api/v1/attachment_service_pb.ts b/web/src/types/proto/api/v1/attachment_service_pb.ts
index a6a767223..b674e9d1a 100644
--- a/web/src/types/proto/api/v1/attachment_service_pb.ts
+++ b/web/src/types/proto/api/v1/attachment_service_pb.ts
@@ -16,7 +16,7 @@ import type { Message } from "@bufbuild/protobuf";
* Describes the file api/v1/attachment_service.proto.
*/
export const file_api_v1_attachment_service: GenFile = /*@__PURE__*/
- fileDesc("Ch9hcGkvdjEvYXR0YWNobWVudF9zZXJ2aWNlLnByb3RvEgxtZW1vcy5hcGkudjEivAEKC01vdGlvbk1lZGlhEi8KBmZhbWlseRgBIAEoDjIfLm1lbW9zLmFwaS52MS5Nb3Rpb25NZWRpYUZhbWlseRIrCgRyb2xlGAIgASgOMh0ubWVtb3MuYXBpLnYxLk1vdGlvbk1lZGlhUm9sZRIQCghncm91cF9pZBgDIAEoCRIhChlwcmVzZW50YXRpb25fdGltZXN0YW1wX3VzGAQgASgDEhoKEmhhc19lbWJlZGRlZF92aWRlbxgFIAEoCCK0AQoNTWVkaWFNZXRhZGF0YRISCgV3aWR0aBgBIAEoBUgBiAEBEhMKBmhlaWdodBgCIAEoBUgCiAEBEiwKBXBob3RvGAMgASgLMhsubWVtb3MuYXBpLnYxLlBob3RvTWV0YWRhdGFIABIsCgV2aWRlbxgEIAEoCzIbLm1lbW9zLmFwaS52MS5WaWRlb01ldGFkYXRhSABCCQoHZGV0YWlsc0IICgZfd2lkdGhCCQoHX2hlaWdodCKjAwoNUGhvdG9NZXRhZGF0YRI0CgxjYXB0dXJlX3RpbWUYASABKAsyHi5tZW1vcy5hcGkudjEuTWVkaWFDYXB0dXJlVGltZRItCghsb2NhdGlvbhgCIAEoCzIbLm1lbW9zLmFwaS52MS5NZWRpYUxvY2F0aW9uEiQKF3NvdXJjZV9leGlmX29yaWVudGF0aW9uGAMgASgFSACIAQESEwoLY2FtZXJhX21ha2UYBCABKAkSFAoMY2FtZXJhX21vZGVsGAUgASgJEhIKCmxlbnNfbW9kZWwYBiABKAkSFQoIZl9udW1iZXIYByABKAFIAYgBARIiChVleHBvc3VyZV90aW1lX3NlY29uZHMYCCABKAFIAogBARIQCgNpc28YCSABKAVIA4gBARIcCg9mb2NhbF9sZW5ndGhfbW0YCiABKAFIBIgBAUIaChhfc291cmNlX2V4aWZfb3JpZW50YXRpb25CCwoJX2ZfbnVtYmVyQhgKFl9leHBvc3VyZV90aW1lX3NlY29uZHNCBgoEX2lzb0ISChBfZm9jYWxfbGVuZ3RoX21tIlMKEE1lZGlhQ2FwdHVyZVRpbWUSFwoPbG9jYWxfZGF0ZV90aW1lGAEgASgJEhcKCnV0Y19vZmZzZXQYAiABKAlIAIgBAUINCgtfdXRjX29mZnNldCKLAQoNTWVkaWFMb2NhdGlvbhIVCghsYXRpdHVkZRgBIAEoAUgAiAEBEhYKCWxvbmdpdHVkZRgCIAEoAUgBiAEBEhwKD2FsdGl0dWRlX21ldGVycxgDIAEoAUgCiAEBQgsKCV9sYXRpdHVkZUIMCgpfbG9uZ2l0dWRlQhIKEF9hbHRpdHVkZV9tZXRlcnMiQwoNVmlkZW9NZXRhZGF0YRIdChBkdXJhdGlvbl9zZWNvbmRzGAEgASgBSACIAQFCEwoRX2R1cmF0aW9uX3NlY29uZHMiqQMKCkF0dGFjaG1lbnQSEQoEbmFtZRgBIAEoCUID4EEIEjQKC2NyZWF0ZV90aW1lGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEID4EEDEhUKCGZpbGVuYW1lGAMgASgJQgPgQQISFAoHY29udGVudBgEIAEoDEID4EEEEhoKDWV4dGVybmFsX2xpbmsYBSABKAlCA+BBARIRCgR0eXBlGAYgASgJQgPgQQISEQoEc2l6ZRgHIAEoA0ID4EEDEhYKBG1lbW8YCCABKAlCA+BBAUgAiAEBEjQKDG1vdGlvbl9tZWRpYRgJIAEoCzIZLm1lbW9zLmFwaS52MS5Nb3Rpb25NZWRpYUID4EEBEjsKDm1lZGlhX21ldGFkYXRhGAogASgLMhsubWVtb3MuYXBpLnYxLk1lZGlhTWV0YWRhdGFCBuBBAeBBBTpP6kFMChdtZW1vcy5hcGkudjEvQXR0YWNobWVudBIYYXR0YWNobWVudHMve2F0dGFjaG1lbnR9KgthdHRhY2htZW50czIKYXR0YWNobWVudEIHCgVfbWVtbyJoChdDcmVhdGVBdHRhY2htZW50UmVxdWVzdBIxCgphdHRhY2htZW50GAEgASgLMhgubWVtb3MuYXBpLnYxLkF0dGFjaG1lbnRCA+BBAhIaCg1hdHRhY2htZW50X2lkGAIgASgJQgPgQQEitQEKF1VwbG9hZEF0dGFjaG1lbnRSZXF1ZXN0EjIKBHNwZWMYASABKAsyIi5tZW1vcy5hcGkudjEuVXBsb2FkQXR0YWNobWVudFNwZWNIABITCgl1cGxvYWRfaWQYAiABKAlIABIZCgx3cml0ZV9vZmZzZXQYAyABKANCA+BBAhIRCgRkYXRhGAQgASgMQgPgQQESGQoMZmluaXNoX3dyaXRlGAUgASgIQgPgQQFCCAoGdXBsb2FkIn4KFFVwbG9hZEF0dGFjaG1lbnRTcGVjEjEKCmF0dGFjaG1lbnQYASABKAsyGC5tZW1vcy5hcGkudjEuQXR0YWNobWVudEID4EECEhoKDWF0dGFjaG1lbnRfaWQYAiABKAlCA+BBARIXCgp0b3RhbF9zaXplGAMgASgDQgPgQQEiiwEKGFVwbG9hZEF0dGFjaG1lbnRSZXNwb25zZRIRCgl1cGxvYWRfaWQYASABKAkSFgoOY29tbWl0dGVkX3NpemUYAiABKAMSLAoKYXR0YWNobWVudBgDIAEoCzIYLm1lbW9zLmFwaS52MS5BdHRhY2htZW50EhYKDm1heF9jaHVua19zaXplGAQgASgFIpQBChZMaXN0QXR0YWNobWVudHNSZXF1ZXN0EhYKCXBhZ2Vfc2l6ZRgBIAEoBUID4EEBEhcKCnBhZ2VfdG9rZW4YAiABKAlCA+BBARITCgZmaWx0ZXIYAyABKAlCA+BBARIVCghvcmRlcl9ieRgEIAEoCUID4EEBSgQIBRAGSgQIBhAHUgVzcGFjZVIKdW5hc3NpZ25lZCJhChdMaXN0QXR0YWNobWVudHNSZXNwb25zZRItCgthdHRhY2htZW50cxgBIAMoCzIYLm1lbW9zLmFwaS52MS5BdHRhY2htZW50EhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSJFChRHZXRBdHRhY2htZW50UmVxdWVzdBItCgRuYW1lGAEgASgJQh/gQQL6QRkKF21lbW9zLmFwaS52MS9BdHRhY2htZW50IoIBChdVcGRhdGVBdHRhY2htZW50UmVxdWVzdBIxCgphdHRhY2htZW50GAEgASgLMhgubWVtb3MuYXBpLnYxLkF0dGFjaG1lbnRCA+BBAhI0Cgt1cGRhdGVfbWFzaxgCIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE1hc2tCA+BBAiJIChdEZWxldGVBdHRhY2htZW50UmVxdWVzdBItCgRuYW1lGAEgASgJQh/gQQL6QRkKF21lbW9zLmFwaS52MS9BdHRhY2htZW50IjMKHUJhdGNoRGVsZXRlQXR0YWNobWVudHNSZXF1ZXN0EhIKBW5hbWVzGAEgAygJQgPgQQIqaAoRTW90aW9uTWVkaWFGYW1pbHkSIwofTU9USU9OX01FRElBX0ZBTUlMWV9VTlNQRUNJRklFRBAAEhQKEEFQUExFX0xJVkVfUEhPVE8QARIYChRBTkRST0lEX01PVElPTl9QSE9UTxACKlkKD01vdGlvbk1lZGlhUm9sZRIhCh1NT1RJT05fTUVESUFfUk9MRV9VTlNQRUNJRklFRBAAEgkKBVNUSUxMEAESCQoFVklERU8QAhINCglDT05UQUlORVIQAzLbBwoRQXR0YWNobWVudFNlcnZpY2USiQEKEENyZWF0ZUF0dGFjaG1lbnQSJS5tZW1vcy5hcGkudjEuQ3JlYXRlQXR0YWNobWVudFJlcXVlc3QaGC5tZW1vcy5hcGkudjEuQXR0YWNobWVudCI02kEKYXR0YWNobWVudILT5JMCIToKYXR0YWNobWVudCITL2FwaS92MS9hdHRhY2htZW50cxKIAQoQVXBsb2FkQXR0YWNobWVudBIlLm1lbW9zLmFwaS52MS5VcGxvYWRBdHRhY2htZW50UmVxdWVzdBomLm1lbW9zLmFwaS52MS5VcGxvYWRBdHRhY2htZW50UmVzcG9uc2UiJYLT5JMCHzoBKiIaL2FwaS92MS9hdHRhY2htZW50czp1cGxvYWQSewoPTGlzdEF0dGFjaG1lbnRzEiQubWVtb3MuYXBpLnYxLkxpc3RBdHRhY2htZW50c1JlcXVlc3QaJS5tZW1vcy5hcGkudjEuTGlzdEF0dGFjaG1lbnRzUmVzcG9uc2UiG4LT5JMCFRITL2FwaS92MS9hdHRhY2htZW50cxJ6Cg1HZXRBdHRhY2htZW50EiIubWVtb3MuYXBpLnYxLkdldEF0dGFjaG1lbnRSZXF1ZXN0GhgubWVtb3MuYXBpLnYxLkF0dGFjaG1lbnQiK9pBBG5hbWWC0+STAh4SHC9hcGkvdjEve25hbWU9YXR0YWNobWVudHMvKn0SqQEKEFVwZGF0ZUF0dGFjaG1lbnQSJS5tZW1vcy5hcGkudjEuVXBkYXRlQXR0YWNobWVudFJlcXVlc3QaGC5tZW1vcy5hcGkudjEuQXR0YWNobWVudCJU2kEWYXR0YWNobWVudCx1cGRhdGVfbWFza4LT5JMCNToKYXR0YWNobWVudDInL2FwaS92MS97YXR0YWNobWVudC5uYW1lPWF0dGFjaG1lbnRzLyp9En4KEERlbGV0ZUF0dGFjaG1lbnQSJS5tZW1vcy5hcGkudjEuRGVsZXRlQXR0YWNobWVudFJlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiK9pBBG5hbWWC0+STAh4qHC9hcGkvdjEve25hbWU9YXR0YWNobWVudHMvKn0SiQEKFkJhdGNoRGVsZXRlQXR0YWNobWVudHMSKy5tZW1vcy5hcGkudjEuQmF0Y2hEZWxldGVBdHRhY2htZW50c1JlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiKoLT5JMCJDoBKiIfL2FwaS92MS9hdHRhY2htZW50czpiYXRjaERlbGV0ZUKuAQoQY29tLm1lbW9zLmFwaS52MUIWQXR0YWNobWVudFNlcnZpY2VQcm90b1ABWjBnaXRodWIuY29tL3VzZW1lbW9zL21lbW9zL3Byb3RvL2dlbi9hcGkvdjE7YXBpdjGiAgNNQViqAgxNZW1vcy5BcGkuVjHKAgxNZW1vc1xBcGlcVjHiAhhNZW1vc1xBcGlcVjFcR1BCTWV0YWRhdGHqAg5NZW1vczo6QXBpOjpWMWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp]);
+ fileDesc("Ch9hcGkvdjEvYXR0YWNobWVudF9zZXJ2aWNlLnByb3RvEgxtZW1vcy5hcGkudjEivAEKC01vdGlvbk1lZGlhEi8KBmZhbWlseRgBIAEoDjIfLm1lbW9zLmFwaS52MS5Nb3Rpb25NZWRpYUZhbWlseRIrCgRyb2xlGAIgASgOMh0ubWVtb3MuYXBpLnYxLk1vdGlvbk1lZGlhUm9sZRIQCghncm91cF9pZBgDIAEoCRIhChlwcmVzZW50YXRpb25fdGltZXN0YW1wX3VzGAQgASgDEhoKEmhhc19lbWJlZGRlZF92aWRlbxgFIAEoCCK0AQoNTWVkaWFNZXRhZGF0YRISCgV3aWR0aBgBIAEoBUgBiAEBEhMKBmhlaWdodBgCIAEoBUgCiAEBEiwKBXBob3RvGAMgASgLMhsubWVtb3MuYXBpLnYxLlBob3RvTWV0YWRhdGFIABIsCgV2aWRlbxgEIAEoCzIbLm1lbW9zLmFwaS52MS5WaWRlb01ldGFkYXRhSABCCQoHZGV0YWlsc0IICgZfd2lkdGhCCQoHX2hlaWdodCKjAwoNUGhvdG9NZXRhZGF0YRI0CgxjYXB0dXJlX3RpbWUYASABKAsyHi5tZW1vcy5hcGkudjEuTWVkaWFDYXB0dXJlVGltZRItCghsb2NhdGlvbhgCIAEoCzIbLm1lbW9zLmFwaS52MS5NZWRpYUxvY2F0aW9uEiQKF3NvdXJjZV9leGlmX29yaWVudGF0aW9uGAMgASgFSACIAQESEwoLY2FtZXJhX21ha2UYBCABKAkSFAoMY2FtZXJhX21vZGVsGAUgASgJEhIKCmxlbnNfbW9kZWwYBiABKAkSFQoIZl9udW1iZXIYByABKAFIAYgBARIiChVleHBvc3VyZV90aW1lX3NlY29uZHMYCCABKAFIAogBARIQCgNpc28YCSABKAVIA4gBARIcCg9mb2NhbF9sZW5ndGhfbW0YCiABKAFIBIgBAUIaChhfc291cmNlX2V4aWZfb3JpZW50YXRpb25CCwoJX2ZfbnVtYmVyQhgKFl9leHBvc3VyZV90aW1lX3NlY29uZHNCBgoEX2lzb0ISChBfZm9jYWxfbGVuZ3RoX21tIlMKEE1lZGlhQ2FwdHVyZVRpbWUSFwoPbG9jYWxfZGF0ZV90aW1lGAEgASgJEhcKCnV0Y19vZmZzZXQYAiABKAlIAIgBAUINCgtfdXRjX29mZnNldCKLAQoNTWVkaWFMb2NhdGlvbhIVCghsYXRpdHVkZRgBIAEoAUgAiAEBEhYKCWxvbmdpdHVkZRgCIAEoAUgBiAEBEhwKD2FsdGl0dWRlX21ldGVycxgDIAEoAUgCiAEBQgsKCV9sYXRpdHVkZUIMCgpfbG9uZ2l0dWRlQhIKEF9hbHRpdHVkZV9tZXRlcnMiQwoNVmlkZW9NZXRhZGF0YRIdChBkdXJhdGlvbl9zZWNvbmRzGAEgASgBSACIAQFCEwoRX2R1cmF0aW9uX3NlY29uZHMi1QMKCkF0dGFjaG1lbnQSEQoEbmFtZRgBIAEoCUID4EEIEjQKC2NyZWF0ZV90aW1lGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEID4EEDEhUKCGZpbGVuYW1lGAMgASgJQgPgQQISFAoHY29udGVudBgEIAEoDEID4EEEEhoKDWV4dGVybmFsX2xpbmsYBSABKAlCA+BBARIRCgR0eXBlGAYgASgJQgPgQQISEQoEc2l6ZRgHIAEoA0ID4EEDEhYKBG1lbW8YCCABKAlCA+BBAUgAiAEBEjQKDG1vdGlvbl9tZWRpYRgJIAEoCzIZLm1lbW9zLmFwaS52MS5Nb3Rpb25NZWRpYUID4EEBEjsKDm1lZGlhX21ldGFkYXRhGAogASgLMhsubWVtb3MuYXBpLnYxLk1lZGlhTWV0YWRhdGFCBuBBAeBBBRIqCgdjcmVhdG9yGAsgASgJQhngQQP6QRMKEW1lbW9zLmFwaS52MS9Vc2VyOk/qQUwKF21lbW9zLmFwaS52MS9BdHRhY2htZW50EhhhdHRhY2htZW50cy97YXR0YWNobWVudH0qC2F0dGFjaG1lbnRzMgphdHRhY2htZW50QgcKBV9tZW1vImgKF0NyZWF0ZUF0dGFjaG1lbnRSZXF1ZXN0EjEKCmF0dGFjaG1lbnQYASABKAsyGC5tZW1vcy5hcGkudjEuQXR0YWNobWVudEID4EECEhoKDWF0dGFjaG1lbnRfaWQYAiABKAlCA+BBASK1AQoXVXBsb2FkQXR0YWNobWVudFJlcXVlc3QSMgoEc3BlYxgBIAEoCzIiLm1lbW9zLmFwaS52MS5VcGxvYWRBdHRhY2htZW50U3BlY0gAEhMKCXVwbG9hZF9pZBgCIAEoCUgAEhkKDHdyaXRlX29mZnNldBgDIAEoA0ID4EECEhEKBGRhdGEYBCABKAxCA+BBARIZCgxmaW5pc2hfd3JpdGUYBSABKAhCA+BBAUIICgZ1cGxvYWQifgoUVXBsb2FkQXR0YWNobWVudFNwZWMSMQoKYXR0YWNobWVudBgBIAEoCzIYLm1lbW9zLmFwaS52MS5BdHRhY2htZW50QgPgQQISGgoNYXR0YWNobWVudF9pZBgCIAEoCUID4EEBEhcKCnRvdGFsX3NpemUYAyABKANCA+BBASKLAQoYVXBsb2FkQXR0YWNobWVudFJlc3BvbnNlEhEKCXVwbG9hZF9pZBgBIAEoCRIWCg5jb21taXR0ZWRfc2l6ZRgCIAEoAxIsCgphdHRhY2htZW50GAMgASgLMhgubWVtb3MuYXBpLnYxLkF0dGFjaG1lbnQSFgoObWF4X2NodW5rX3NpemUYBCABKAUilAEKFkxpc3RBdHRhY2htZW50c1JlcXVlc3QSFgoJcGFnZV9zaXplGAEgASgFQgPgQQESFwoKcGFnZV90b2tlbhgCIAEoCUID4EEBEhMKBmZpbHRlchgDIAEoCUID4EEBEhUKCG9yZGVyX2J5GAQgASgJQgPgQQFKBAgFEAZKBAgGEAdSBXNwYWNlUgp1bmFzc2lnbmVkImEKF0xpc3RBdHRhY2htZW50c1Jlc3BvbnNlEi0KC2F0dGFjaG1lbnRzGAEgAygLMhgubWVtb3MuYXBpLnYxLkF0dGFjaG1lbnQSFwoPbmV4dF9wYWdlX3Rva2VuGAIgASgJIkUKFEdldEF0dGFjaG1lbnRSZXF1ZXN0Ei0KBG5hbWUYASABKAlCH+BBAvpBGQoXbWVtb3MuYXBpLnYxL0F0dGFjaG1lbnQiggEKF1VwZGF0ZUF0dGFjaG1lbnRSZXF1ZXN0EjEKCmF0dGFjaG1lbnQYASABKAsyGC5tZW1vcy5hcGkudjEuQXR0YWNobWVudEID4EECEjQKC3VwZGF0ZV9tYXNrGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkZpZWxkTWFza0ID4EECIkgKF0RlbGV0ZUF0dGFjaG1lbnRSZXF1ZXN0Ei0KBG5hbWUYASABKAlCH+BBAvpBGQoXbWVtb3MuYXBpLnYxL0F0dGFjaG1lbnQiMwodQmF0Y2hEZWxldGVBdHRhY2htZW50c1JlcXVlc3QSEgoFbmFtZXMYASADKAlCA+BBAipoChFNb3Rpb25NZWRpYUZhbWlseRIjCh9NT1RJT05fTUVESUFfRkFNSUxZX1VOU1BFQ0lGSUVEEAASFAoQQVBQTEVfTElWRV9QSE9UTxABEhgKFEFORFJPSURfTU9USU9OX1BIT1RPEAIqWQoPTW90aW9uTWVkaWFSb2xlEiEKHU1PVElPTl9NRURJQV9ST0xFX1VOU1BFQ0lGSUVEEAASCQoFU1RJTEwQARIJCgVWSURFTxACEg0KCUNPTlRBSU5FUhADMtsHChFBdHRhY2htZW50U2VydmljZRKJAQoQQ3JlYXRlQXR0YWNobWVudBIlLm1lbW9zLmFwaS52MS5DcmVhdGVBdHRhY2htZW50UmVxdWVzdBoYLm1lbW9zLmFwaS52MS5BdHRhY2htZW50IjTaQQphdHRhY2htZW50gtPkkwIhOgphdHRhY2htZW50IhMvYXBpL3YxL2F0dGFjaG1lbnRzEogBChBVcGxvYWRBdHRhY2htZW50EiUubWVtb3MuYXBpLnYxLlVwbG9hZEF0dGFjaG1lbnRSZXF1ZXN0GiYubWVtb3MuYXBpLnYxLlVwbG9hZEF0dGFjaG1lbnRSZXNwb25zZSIlgtPkkwIfOgEqIhovYXBpL3YxL2F0dGFjaG1lbnRzOnVwbG9hZBJ7Cg9MaXN0QXR0YWNobWVudHMSJC5tZW1vcy5hcGkudjEuTGlzdEF0dGFjaG1lbnRzUmVxdWVzdBolLm1lbW9zLmFwaS52MS5MaXN0QXR0YWNobWVudHNSZXNwb25zZSIbgtPkkwIVEhMvYXBpL3YxL2F0dGFjaG1lbnRzEnoKDUdldEF0dGFjaG1lbnQSIi5tZW1vcy5hcGkudjEuR2V0QXR0YWNobWVudFJlcXVlc3QaGC5tZW1vcy5hcGkudjEuQXR0YWNobWVudCIr2kEEbmFtZYLT5JMCHhIcL2FwaS92MS97bmFtZT1hdHRhY2htZW50cy8qfRKpAQoQVXBkYXRlQXR0YWNobWVudBIlLm1lbW9zLmFwaS52MS5VcGRhdGVBdHRhY2htZW50UmVxdWVzdBoYLm1lbW9zLmFwaS52MS5BdHRhY2htZW50IlTaQRZhdHRhY2htZW50LHVwZGF0ZV9tYXNrgtPkkwI1OgphdHRhY2htZW50MicvYXBpL3YxL3thdHRhY2htZW50Lm5hbWU9YXR0YWNobWVudHMvKn0SfgoQRGVsZXRlQXR0YWNobWVudBIlLm1lbW9zLmFwaS52MS5EZWxldGVBdHRhY2htZW50UmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIr2kEEbmFtZYLT5JMCHiocL2FwaS92MS97bmFtZT1hdHRhY2htZW50cy8qfRKJAQoWQmF0Y2hEZWxldGVBdHRhY2htZW50cxIrLm1lbW9zLmFwaS52MS5CYXRjaERlbGV0ZUF0dGFjaG1lbnRzUmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIqgtPkkwIkOgEqIh8vYXBpL3YxL2F0dGFjaG1lbnRzOmJhdGNoRGVsZXRlQq4BChBjb20ubWVtb3MuYXBpLnYxQhZBdHRhY2htZW50U2VydmljZVByb3RvUAFaMGdpdGh1Yi5jb20vdXNlbWVtb3MvbWVtb3MvcHJvdG8vZ2VuL2FwaS92MTthcGl2MaICA01BWKoCDE1lbW9zLkFwaS5WMcoCDE1lbW9zXEFwaVxWMeICGE1lbW9zXEFwaVxWMVxHUEJNZXRhZGF0YeoCDk1lbW9zOjpBcGk6OlYxYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp]);
/**
* @generated from message memos.api.v1.MotionMedia
@@ -322,6 +322,14 @@ export type Attachment = Message<"memos.api.v1.Attachment"> & {
* @generated from field: memos.api.v1.MediaMetadata media_metadata = 10;
*/
mediaMetadata?: MediaMetadata | undefined;
+
+ /**
+ * Output only. The user who uploaded this attachment, which may differ from
+ * the creator of the linked memo. Format: users/{user}.
+ *
+ * @generated from field: string creator = 11;
+ */
+ creator: string;
};
/**
@@ -524,7 +532,9 @@ export type ListAttachmentsRequest = Message<"memos.api.v1.ListAttachmentsReques
* Optional. Filter to apply to the list results.
* Example: "mime_type==\"image/png\"" or "filename.contains(\"test\")"
* Supported operators: =, !=, <, <=, >, >=, : (contains), in
- * Supported fields: filename, mime_type, create_time, memo_id, space.
+ * Supported fields: creator, filename, mime_type, create_time, memo_id, space.
+ * `creator` is the linked memo's creator, or the uploader for an unlinked
+ * attachment. It supports equality with a User resource name.
* `space` only supports a non-negated `==` comparison with a Space resource
* name or null.
* `space` is the linked memo's space resource name, or null when the
@@ -745,7 +755,7 @@ export const AttachmentService: GenService<{
output: typeof UploadAttachmentResponseSchema;
},
/**
- * ListAttachments lists all attachments.
+ * ListAttachments lists attachments linked to readable memos and the caller's unlinked uploads.
*
* @generated from rpc memos.api.v1.AttachmentService.ListAttachments
*/
diff --git a/web/src/utils/redirect-safety.ts b/web/src/utils/redirect-safety.ts
index 234dc5b54..9acc27e72 100644
--- a/web/src/utils/redirect-safety.ts
+++ b/web/src/utils/redirect-safety.ts
@@ -60,7 +60,7 @@ const PUBLIC_ROUTE_PREFIXES = [
ROUTES.ABOUT, // About page
ROUTES.EXPLORE, // Explore page
`${ROUTES.SHARED_MEMO}/`, // Shared memo pages (share-link viewer)
- "/u/", // User profile pages (dynamic)
+ "/u/", // Legacy author links redirect to Home with a creator filter
"/memos/", // Individual memo detail pages (dynamic)
] as const;
diff --git a/web/tests/app-sidebar-logo.test.tsx b/web/tests/app-sidebar-logo.test.tsx
index d270f138a..ca90ede36 100644
--- a/web/tests/app-sidebar-logo.test.tsx
+++ b/web/tests/app-sidebar-logo.test.tsx
@@ -4,16 +4,16 @@ import { MemoryRouter, useLocation } from "react-router-dom";
import { beforeEach, describe, expect, it, vi } from "vitest";
import AppSidebar, { MobileAppHeader, MobileAppSidebar } from "@/components/AppSidebar";
import { SIDEBAR_SECTION_ACTION_ICON_CLASSES } from "@/components/AppSidebar/SidebarSection";
-import { type MemoFilter, parseFilterQuery } from "@/contexts/MemoFilterContext";
-import { resolveCollectionRoute } from "@/router/routes";
+import { type MemoFilter } from "@/contexts/MemoFilterContext";
+import { getCollectionCreator, resolveCollectionRoute } from "@/router/routes";
const authState = vi.hoisted(() => ({
currentUser: { name: "users/test" } as { name: string } | undefined,
memoViews: [] as Array<{ name: string; title: string }>,
notifications: [] as Array<{ status: number }>,
+ guestCreator: undefined as { username: string; displayName: string; avatarUrl: string } | undefined,
}));
const sidebarState = vi.hoisted(() => ({
- memoScope: "home" as "home" | "explore",
mobileOpen: false,
setMobileOpen: vi.fn(),
setQuickFindOpen: vi.fn(),
@@ -45,6 +45,7 @@ vi.mock("@/components/UserMenu", () => ({
User menu
</button>
),
+ UserPreferenceDialog: () => null,
}));
vi.mock("@/components/CreateSpaceDialog", () => ({
@@ -74,8 +75,6 @@ vi.mock("@/contexts/AppSidebarContext", () => ({
setMobileOpen: sidebarState.setMobileOpen,
quickFindOpen: false,
setQuickFindOpen: sidebarState.setQuickFindOpen,
- memoScope: sidebarState.memoScope,
- setMemoScope: vi.fn(),
}),
}));
@@ -102,7 +101,8 @@ vi.mock("@/contexts/MemoFilterContext", async (importOriginal) => ({
vi.mock("@/contexts/SpaceContext", () => ({
useSpaceContext: () => {
- const { spaceName } = resolveCollectionRoute(useLocation().pathname);
+ const location = useLocation();
+ const { spaceName, isCollection } = resolveCollectionRoute(location.pathname);
const duplicateSpaceTitles = new Set(
spaceState.spaces
.filter((space, index) => spaceState.spaces.findIndex((candidate) => candidate.title === space.title) !== index)
@@ -111,6 +111,7 @@ vi.mock("@/contexts/SpaceContext", () => ({
return {
...spaceState,
selectedSpaceName: spaceName,
+ creatorUsername: isCollection ? getCollectionCreator(location.search) : undefined,
selectedSpace: spaceName ? spaceState.selectedSpace : undefined,
memoFilter: spaceName ? `space == ${JSON.stringify(spaceName)}` : undefined,
duplicateSpaceTitles,
@@ -145,7 +146,7 @@ vi.mock("@/hooks/useUserQueries", () => ({
},
useMemoViews: () => ({ data: authState.memoViews }),
useNotifications: () => ({ data: authState.notifications }),
- useUser: () => ({ data: undefined }),
+ useUser: () => ({ data: authState.guestCreator }),
}));
vi.mock("@/i18n", () => ({
@@ -175,7 +176,7 @@ const expectExpandedNavPill = (pill: HTMLElement, label: string) => {
expect(pill.firstElementChild).toHaveClass("size-4");
const labelTrack = pill.querySelector("span.grid");
// The label opens only where the row can afford it; the control's aria-label names it regardless.
- expect(labelTrack).toHaveClass("@min-[230px]:grid-cols-[1fr]", "@min-[230px]:ps-2");
+ expect(labelTrack).toHaveClass("@min-[230px]:grid-cols-[1fr]", "@min-[230px]:ps-1.5");
expect(labelTrack).toHaveAttribute("aria-hidden", "true");
expect(pill.querySelector("[data-sidebar-label]")).toHaveTextContent(label);
};
@@ -195,7 +196,7 @@ describe("App sidebar logo", () => {
authState.currentUser = { name: "users/test" };
authState.memoViews = [];
authState.notifications = [];
- sidebarState.memoScope = "home";
+ authState.guestCreator = undefined;
sidebarState.mobileOpen = false;
sidebarState.setMobileOpen.mockClear();
sidebarState.setQuickFindOpen.mockClear();
@@ -209,26 +210,16 @@ describe("App sidebar logo", () => {
tagsSectionHook.mockClear();
});
- it("preserves a CEL expression when switching sidebar scopes", async () => {
- const expression = 'tags.exists(t, t.contains("50%, café & C++"))\n || pinned';
- filterState.filters = [{ factor: "celSearch", value: expression }];
- const LocationProbe = () => {
- const location = useLocation();
- return (
- <output data-testid="scope-location">
- {JSON.stringify({ path: location.pathname, filters: parseFilterQuery(new URLSearchParams(location.search).get("filter")) })}
- </output>
- );
- };
+ it("preserves creator and filters, excluding map state, when moving between collection pages", () => {
render(
- <MemoryRouter initialEntries={["/"]}>
+ <MemoryRouter initialEntries={["/spaces/product/map?creator=alice&filter=tagSearch%3Awork&lat=31&lng=121&zoom=12&memo=memos/a"]}>
<AppSidebar />
- <LocationProbe />
</MemoryRouter>,
);
- fireEvent.click(screen.getByRole("button", { name: "common.home" }));
- fireEvent.click(await screen.findByRole("menuitem", { name: "common.explore" }));
- expect(screen.getByTestId("scope-location")).toHaveTextContent(JSON.stringify({ path: "/explore", filters: filterState.filters }));
+ const search = "?filter=tagSearch%3Awork&creator=alice";
+ expect(screen.getByRole("link", { name: "common.timeline" })).toHaveAttribute("href", `/spaces/product${search}`);
+ expect(screen.getByRole("link", { name: "common.calendar" })).toHaveAttribute("href", `/spaces/product/calendar${search}`);
+ expect(screen.getByRole("link", { name: "common.attachments" })).toHaveAttribute("href", `/spaces/product/attachments${search}`);
});
it("shows the context switcher and opens the global memo editor", () => {
@@ -292,7 +283,6 @@ describe("App sidebar logo", () => {
it.each([
"/archived",
"/inbox",
- "/u/alice",
"/setting",
"/about",
"/views",
@@ -322,7 +312,7 @@ describe("App sidebar logo", () => {
</MemoryRouter>,
);
- expect(filteredStatsHook).toHaveBeenCalledWith(expect.objectContaining({ context: "explore", filter: 'space == "spaces/product"' }));
+ expect(filteredStatsHook).toHaveBeenCalledWith(expect.objectContaining({ context: "collection", filter: 'space == "spaces/product"' }));
});
it("includes authorized Space memos in All Explore statistics", () => {
@@ -332,18 +322,7 @@ describe("App sidebar logo", () => {
</MemoryRouter>,
);
- expect(filteredStatsHook).toHaveBeenCalledWith(expect.objectContaining({ context: "explore", filter: undefined }));
- });
-
- it("keeps Profile statistics and tag UI state unscoped by Space", () => {
- render(
- <MemoryRouter initialEntries={["/u/alice"]}>
- <AppSidebar />
- </MemoryRouter>,
- );
-
- expect(filteredStatsHook).toHaveBeenCalledWith(expect.objectContaining({ context: "profile", filter: undefined }));
- expect(tagsSectionHook).toHaveBeenCalledWith(expect.objectContaining({ scope: "profile" }));
+ expect(filteredStatsHook).toHaveBeenCalledWith(expect.objectContaining({ context: "collection", filter: undefined }));
});
it("keeps Archived statistics and tag UI state unscoped by Space", () => {
@@ -357,20 +336,15 @@ describe("App sidebar logo", () => {
expect(tagsSectionHook).toHaveBeenCalledWith(expect.objectContaining({ scope: "archived" }));
});
- it("uses one unified signed-in footer surface", () => {
+ it("shows signed-in account actions in the top switcher", () => {
render(
<MemoryRouter initialEntries={["/inbox"]}>
<AppSidebar />
</MemoryRouter>,
);
-
- const footer = screen.getByRole("button", { name: "User menu" }).closest("footer");
- expect(footer).not.toBeNull();
- expect(footer).not.toHaveClass("px-3");
- expect(footer).not.toHaveClass("py-1");
- expect(footer).not.toHaveClass("py-1.5");
- expect(footer?.childElementCount).toBe(1);
- expect(screen.queryByRole("link", { name: /^common\.inbox/ })).not.toBeInTheDocument();
+ expect(screen.queryByRole("contentinfo")).not.toBeInTheDocument();
+ fireEvent.click(screen.getByRole("button", { name: "space.switch: common.memos" }));
+ expect(screen.getByRole("button", { name: "User menu" })).toBeInTheDocument();
});
it("keeps Attachments active after route normalization", () => {
@@ -415,14 +389,13 @@ describe("App sidebar logo", () => {
</MemoryRouter>,
);
- expect(screen.getByRole("link", { name: "Memos logo" })).toHaveAttribute("href", "/explore");
- expect(screen.queryByRole("button", { name: /^space\.switch:/ })).not.toBeInTheDocument();
+ expect(screen.getByRole("button", { name: "space.switch: common.memos" })).toHaveTextContent("Memos logo");
const primaryNavigation = screen.getByRole("navigation", { name: "Primary" });
- expect(primaryNavigation).toHaveClass("h-7", "items-center", "gap-0.5", "px-3");
+ expect(primaryNavigation).toHaveClass("h-7", "items-center", "gap-1", "px-3");
expect(primaryNavigation).not.toHaveClass("flex-col");
const navigation = within(primaryNavigation);
expect(navigation.getByRole("button", { name: "common.search" })).toHaveClass("ms-auto", "h-7", "px-1.5");
- expectActiveNavPill(navigation.getByRole("link", { name: "common.explore" }), "common.explore");
+ expectActiveNavPill(navigation.getByRole("link", { name: "common.timeline" }), "common.timeline");
const about = navigation.getByRole("link", { name: "common.about" });
expect(about).toHaveAttribute("href", "/about");
expectCollapsedNavPill(about, "common.about");
@@ -431,7 +404,37 @@ describe("App sidebar logo", () => {
expect(signIn).not.toHaveClass("rounded-md");
expect(signIn.closest("footer")).not.toBeNull();
expect(screen.queryByRole("button", { name: "editor.new-memo" })).not.toBeInTheDocument();
- expect(screen.queryByRole("link", { name: "common.home" })).not.toBeInTheDocument();
+ });
+
+ it("shows the selected creator in the guest sidebar and mobile header", () => {
+ authState.currentUser = undefined;
+ authState.guestCreator = { username: "steven", displayName: "Steven", avatarUrl: "/avatar.png" };
+
+ render(
+ <MemoryRouter initialEntries={["/?creator=steven"]}>
+ <AppSidebar />
+ <MobileAppHeader />
+ </MemoryRouter>,
+ );
+
+ const creatorLinks = screen.getAllByRole("button", { name: "space.switch: Steven" });
+ expect(creatorLinks).toHaveLength(2);
+ for (const link of creatorLinks) {
+ expect(link.querySelector("img")).toHaveAttribute("src", "/avatar.png");
+ }
+ expect(screen.queryByRole("link", { name: "Memos logo" })).not.toBeInTheDocument();
+ });
+
+ it("shows the selected username while the guest profile is loading", () => {
+ authState.currentUser = undefined;
+
+ render(
+ <MemoryRouter initialEntries={["/?creator=steven"]}>
+ <AppSidebar />
+ </MemoryRouter>,
+ );
+
+ expect(screen.getByRole("button", { name: "space.switch: steven" })).toHaveTextContent("steven");
});
it.each(["/403", "/404", "/unknown"])("uses the common sidebar without inheriting collection content on %s", (path) => {
@@ -458,13 +461,12 @@ describe("App sidebar logo", () => {
expect(screen.queryByText("Tags")).not.toBeInTheDocument();
expect(screen.getByRole("button", { name: "space.switch: common.memos" })).toBeInTheDocument();
const navigation = within(screen.getByRole("navigation", { name: "Primary" }));
- expectDefaultNavPill(navigation.getByRole("button", { name: "common.home" }), "common.home");
+ expectDefaultNavPill(navigation.getByRole("link", { name: "common.timeline" }), "common.timeline");
const attachments = navigation.getByRole("link", { name: "common.attachments" });
expect(attachments).toHaveAttribute("href", "/attachments");
expectCollapsedNavPill(attachments, "common.attachments");
expect(screen.queryByRole("link", { name: "common.inbox" })).not.toBeInTheDocument();
- expect(screen.queryByRole("link", { name: "common.home" })).not.toBeInTheDocument();
- expect(screen.getByText("User menu").closest("footer")).not.toBeNull();
+ expect(screen.queryByRole("contentinfo")).not.toBeInTheDocument();
});
it.each(["/about", "/About/"])("marks the common About link active on %s", (path) => {
@@ -478,8 +480,8 @@ describe("App sidebar logo", () => {
expect(screen.getByRole("heading", { name: "common.resources", level: 2 })).toBeInTheDocument();
const navigation = within(screen.getByRole("navigation", { name: "Primary" }));
- const scopeTrigger = navigation.getByRole("button", { name: "common.home" });
- expectDefaultNavPill(scopeTrigger, "common.home");
+ const scopeTrigger = navigation.getByRole("link", { name: "common.timeline" });
+ expectDefaultNavPill(scopeTrigger, "common.timeline");
expect(scopeTrigger.querySelector(".lucide-chevron-down")).not.toBeInTheDocument();
expectCollapsedNavPill(navigation.getByRole("link", { name: "common.attachments" }), "common.attachments");
});
@@ -493,10 +495,9 @@ describe("App sidebar logo", () => {
);
const navigation = within(screen.getByRole("navigation", { name: "Primary" }));
- const explore = navigation.getByRole("link", { name: "common.explore" });
- expect(explore).toHaveAttribute("href", "/explore");
- expectDefaultNavPill(explore, "common.explore");
- expect(screen.queryByRole("link", { name: "common.home" })).not.toBeInTheDocument();
+ const home = navigation.getByRole("link", { name: "common.timeline" });
+ expect(home).toHaveAttribute("href", "/explore");
+ expectDefaultNavPill(home, "common.timeline");
expect(screen.queryByRole("link", { name: "common.attachments" })).not.toBeInTheDocument();
expect(screen.queryByRole("link", { name: "common.inbox" })).not.toBeInTheDocument();
const about = navigation.getByRole("link", { name: "common.about" });
@@ -514,7 +515,7 @@ describe("App sidebar logo", () => {
);
const navigation = within(screen.getByRole("navigation", { name: "Primary" }));
- expectCollapsedNavPill(navigation.getByRole("link", { name: "common.explore" }), "common.explore");
+ expectCollapsedNavPill(navigation.getByRole("link", { name: "common.timeline" }), "common.timeline");
expectActiveNavPill(navigation.getByRole("link", { name: "common.about" }), "common.about");
expect(screen.queryByText("Calendar")).not.toBeInTheDocument();
});
@@ -533,23 +534,53 @@ describe("App sidebar logo", () => {
expect(calendar.compareDocumentPosition(views) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
const viewOptions = screen.getByRole("button", { name: "memo.view-options" });
const createView = screen.getByRole("button", { name: "common.create" });
- expect(viewOptions.compareDocumentPosition(createView) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
+ expect(viewOptions.closest("nav")).toBe(screen.getByRole("navigation", { name: "Primary" }));
+ expect(screen.getByRole("link", { name: "common.timeline" }).nextElementSibling).toBe(viewOptions);
+ expect(viewOptions.parentElement).toHaveClass("bg-sidebar-accent", "rounded-md");
+ expect(viewOptions.closest("a")).toBeNull();
expect(createView).toHaveClass("size-6", "rounded-md", "text-muted-foreground/70", "hover:bg-muted/60", "hover:text-foreground");
expect(createView.querySelector("svg")).toHaveClass(SIDEBAR_SECTION_ACTION_ICON_CLASSES);
const tasksView = screen.getByRole("button", { name: "common.tasks" });
expect(tasksView).toHaveTextContent("common.tasks");
expect(tasksView).not.toHaveTextContent("☑️");
- expect(screen.queryByRole("button", { name: "common.all" })).not.toBeInTheDocument();
+ expect(screen.queryByRole("button", { name: "common.explore" })).not.toBeInTheDocument();
- const scopeTrigger = screen.getByRole("button", { name: "common.home" });
- expectActiveNavPill(scopeTrigger, "common.home");
- expect(scopeTrigger.querySelector(".lucide-chevron-down")).toBeInTheDocument();
- expect(scopeTrigger.querySelector(".lucide-chevrons-up-down")).not.toBeInTheDocument();
+ const home = screen.getByRole("link", { name: "common.timeline" });
+ expectActiveNavPill(home, "common.timeline");
+ expect(home.querySelector(".lucide-chevron-down")).not.toBeInTheDocument();
expectCollapsedNavPill(screen.getByRole("link", { name: "common.attachments" }), "common.attachments");
- fireEvent.click(scopeTrigger);
- expect(await screen.findByRole("menuitem", { name: "common.home" })).toBeInTheDocument();
- expect(screen.getByRole("menuitem", { name: "common.explore" })).toBeInTheDocument();
- expect(screen.queryByRole("menuitem", { name: "common.archived" })).not.toBeInTheDocument();
+ expect(screen.queryByRole("menuitem", { name: "common.explore" })).not.toBeInTheDocument();
+ });
+
+ it.each([
+ "/explore",
+ "/?creator=alice",
+ "/spaces/test",
+ "/spaces/test/explore",
+ ])("shows Timeline display settings in every Timeline scope: %s", (path) => {
+ render(
+ <MemoryRouter initialEntries={[path]}>
+ <AppSidebar />
+ </MemoryRouter>,
+ );
+ expect(
+ within(screen.getByRole("navigation", { name: "Primary" })).getByRole("button", { name: "memo.view-options" }),
+ ).toBeInTheDocument();
+ });
+
+ it.each([
+ "/calendar",
+ "/map",
+ "/attachments",
+ "/archived",
+ "/spaces/test/calendar",
+ ])("hides Timeline display settings on other views: %s", (path) => {
+ render(
+ <MemoryRouter initialEntries={[path]}>
+ <AppSidebar />
+ </MemoryRouter>,
+ );
+ expect(screen.queryByRole("button", { name: "memo.view-options" })).not.toBeInTheDocument();
});
it("uses compact text-only actions for a saved view", async () => {
@@ -572,33 +603,23 @@ describe("App sidebar logo", () => {
expect(deleteItem).toHaveAttribute("data-variant", "destructive");
});
- it("keeps collection navigation together and uses the unified user footer", async () => {
+ it("keeps collection navigation together with Home as a direct link", () => {
render(
<MemoryRouter initialEntries={["/attachments"]}>
<AppSidebar />
</MemoryRouter>,
);
-
- const scopeTrigger = screen.getByRole("button", { name: "common.home" });
- expectCollapsedNavPill(scopeTrigger, "common.home");
-
- expect(screen.getByRole("button", { name: "User menu" }).closest("footer")).not.toBeNull();
- expect(screen.queryByRole("link", { name: "common.inbox" })).not.toBeInTheDocument();
-
- const attachments = screen.getByRole("link", { name: "common.attachments" });
- expectActiveNavPill(attachments, "common.attachments");
-
- fireEvent.click(scopeTrigger);
- expect(await screen.findByText("Calendar")).toBeInTheDocument();
- expectActiveNavPill(screen.getByRole("button", { name: "common.home" }), "common.home");
- expect(screen.queryByRole("menuitem", { name: "common.explore" })).not.toBeInTheDocument();
+ const home = screen.getByRole("link", { name: "common.timeline" });
+ expectCollapsedNavPill(home, "common.timeline");
+ expect(home).toHaveAttribute("href", "/explore");
+ expect(screen.queryByRole("contentinfo")).not.toBeInTheDocument();
+ expectActiveNavPill(screen.getByRole("link", { name: "common.attachments" }), "common.attachments");
});
it.each([
["/attachments", "common.attachments"],
["/inbox", "common.inbox"],
["/setting", "common.basic"],
- ["/u/test", "common.profile"],
])("labels the sidebar content section on %s", (path, label) => {
render(
<MemoryRouter initialEntries={[path]}>
@@ -609,38 +630,16 @@ describe("App sidebar logo", () => {
expect(screen.getByRole("heading", { name: label, level: 2 })).toBeInTheDocument();
});
- it("keeps the Explore scope available from a global destination", async () => {
- sidebarState.memoScope = "explore";
+ it.each(["/inbox", "/archived"])("shows Home as the direct destination from %s", (path) => {
render(
- <MemoryRouter initialEntries={["/inbox"]}>
- <AppSidebar />
- </MemoryRouter>,
- );
-
- const scopeTrigger = screen.getByRole("button", { name: "common.explore" });
- expectDefaultNavPill(scopeTrigger, "common.explore");
- expect(scopeTrigger.querySelector(".lucide-chevron-down")).not.toBeInTheDocument();
- expectCollapsedNavPill(screen.getByRole("link", { name: "common.attachments" }), "common.attachments");
-
- fireEvent.click(scopeTrigger);
- expectActiveNavPill(await screen.findByRole("button", { name: "common.explore", current: "page" }), "common.explore");
- });
-
- it("leaves Archived through the remembered primary feed without presenting it as a scope", async () => {
- sidebarState.memoScope = "explore";
- render(
- <MemoryRouter initialEntries={["/archived"]}>
+ <MemoryRouter initialEntries={[path]}>
<AppSidebar />
</MemoryRouter>,
);
-
- const scopeTrigger = screen.getByRole("button", { name: "common.explore" });
- expectDefaultNavPill(scopeTrigger, "common.explore");
- expect(scopeTrigger.querySelector(".lucide-chevron-down")).not.toBeInTheDocument();
- expectCollapsedNavPill(screen.getByRole("link", { name: "common.attachments" }), "common.attachments");
-
- fireEvent.click(scopeTrigger);
- expectActiveNavPill(await screen.findByRole("button", { name: "common.explore", current: "page" }), "common.explore");
+ const home = screen.getByRole("link", { name: "common.timeline" });
+ expectDefaultNavPill(home, "common.timeline");
+ expect(home).toHaveAttribute("href", "/");
+ expect(screen.queryByRole("button", { name: "common.explore" })).not.toBeInTheDocument();
});
it("keeps the mobile header limited to navigation and context", () => {
diff --git a/web/tests/app-sidebar-routes.test.ts b/web/tests/app-sidebar-routes.test.ts
index 2a98b9721..1a5a23b11 100644
--- a/web/tests/app-sidebar-routes.test.ts
+++ b/web/tests/app-sidebar-routes.test.ts
@@ -8,8 +8,8 @@ describe("sidebar route content", () => {
["/explore", "explore"],
["/Explore/", "explore"],
["/ARCHIVED/", "archived"],
- ["/u/steven", "profile"],
- ["/U/Steven/", "profile"],
+ ["/u/steven", "common"],
+ ["/U/Steven/", "common"],
["/views", "views"],
["/Views/", "views"],
["/calendar", "calendar"],
@@ -45,24 +45,17 @@ describe("sidebar route content", () => {
});
});
- it.each(["/attachments", "/calendar/2026/08/02"])("keeps the route scope when %s sends search to Home", (path) => {
+ it.each(["/attachments", "/calendar/2026/08/02"])("keeps the All scope when %s sends search to Explore", (path) => {
expect(getRouteActionPolicy(path)).toEqual({
searchScope: "route-collection",
- searchDestination: "/",
+ searchDestination: "/explore",
});
});
- it("keeps Profile search on Profile", () => {
- expect(getRouteActionPolicy("/u/steven")).toEqual({
- searchScope: "profile",
- searchDestination: "/u/steven",
- });
- });
-
- it("normalizes a Profile route without changing its spelling", () => {
- expect(getRouteActionPolicy("/U/Steven/")).toEqual({
- searchScope: "profile",
- searchDestination: "/U/Steven",
+ it("keeps a creator when Calendar sends search to Home", () => {
+ expect(getRouteActionPolicy("/spaces/a/calendar/2026/08/02", "?creator=alice")).toEqual({
+ searchScope: "route-collection",
+ searchDestination: "/spaces/a",
});
});
@@ -86,7 +79,7 @@ describe("sidebar route content", () => {
])("sends search to All on %s", (path) => {
expect(getRouteActionPolicy(path)).toEqual({
searchScope: "all",
- searchDestination: "/",
+ searchDestination: "/explore",
});
});
});
diff --git a/web/tests/attachment-library-source-link.test.tsx b/web/tests/attachment-library-source-link.test.tsx
index 884be2bf3..0d02f3269 100644
--- a/web/tests/attachment-library-source-link.test.tsx
+++ b/web/tests/attachment-library-source-link.test.tsx
@@ -2,9 +2,11 @@ import { create } from "@bufbuild/protobuf";
import { fireEvent, render, screen } from "@testing-library/react";
import { MemoryRouter, useLocation } from "react-router-dom";
import { describe, expect, it, vi } from "vitest";
+import { AttachmentDocumentRows } from "@/components/AttachmentLibrary/AttachmentFileRows";
import AttachmentMediaGrid from "@/components/AttachmentLibrary/AttachmentMediaGrid";
import type { AttachmentLibraryMonthGroup } from "@/hooks/useAttachmentLibrary";
import { AttachmentSchema, MediaMetadataSchema, VideoMetadataSchema } from "@/types/proto/api/v1/attachment_service_pb";
+import { UserSchema } from "@/types/proto/api/v1/user_service_pb";
vi.mock("@/utils/i18n", () => ({ useTranslate: () => (key: string) => key }));
@@ -20,7 +22,9 @@ describe("<AttachmentMediaGrid>", () => {
filename: "photo.jpg",
type: "image/jpeg",
memo: "memos/source-memo",
+ creator: "users/steven",
});
+ const creator = create(UserSchema, { name: "users/steven", username: "steven", displayName: "Steven" });
const groups: AttachmentLibraryMonthGroup[] = [
{
key: "2026-07",
@@ -53,13 +57,14 @@ describe("<AttachmentMediaGrid>", () => {
render(
<MemoryRouter initialEntries={["/spaces/product/attachments?filter=tagSearch%3Awork"]}>
- <AttachmentMediaGrid groups={groups} onPreview={onPreview} />
+ <AttachmentMediaGrid groups={groups} creators={new Map([[creator.name, creator]])} onPreview={onPreview} />
<LocationStateProbe />
</MemoryRouter>,
);
const memoLink = screen.getByRole("link", { name: "attachment-library.labels.memo" });
expect(memoLink).toHaveAttribute("href", "/memos/source-memo");
+ expect(screen.getByRole("link", { name: "Steven" })).toHaveAttribute("href", "/?creator=steven");
const fileLink = screen.getByRole("link", { name: "attachment-library.actions.open" });
expect(fileLink).toHaveAttribute("href", "/file/attachments/photo/photo.jpg");
@@ -70,6 +75,26 @@ describe("<AttachmentMediaGrid>", () => {
expect(screen.getByTestId("location-state")).toHaveTextContent('{"from":"/spaces/product/attachments?filter=tagSearch%3Awork"}');
});
+ it("shows the uploader on document rows", () => {
+ const attachment = create(AttachmentSchema, {
+ name: "attachments/document",
+ filename: "plan.pdf",
+ type: "application/pdf",
+ creator: "users/steven",
+ memo: "memos/source-memo",
+ });
+
+ render(
+ <MemoryRouter>
+ <AttachmentDocumentRows
+ items={[{ attachment, createdLabel: "Jul 29, 2026", fileTypeLabel: "PDF", memoName: attachment.memo, sourceUrl: "/plan.pdf" }]}
+ />
+ </MemoryRouter>,
+ );
+
+ expect(screen.getByRole("link", { name: "steven" })).toHaveAttribute("href", "/?creator=steven");
+ });
+
it("keeps video duration inside the existing play badge", () => {
const attachment = create(AttachmentSchema, {
name: "attachments/video",
diff --git a/web/tests/date-filter-navigation.test.tsx b/web/tests/date-filter-navigation.test.tsx
index 82d014115..fb0cb7ce6 100644
--- a/web/tests/date-filter-navigation.test.tsx
+++ b/web/tests/date-filter-navigation.test.tsx
@@ -20,7 +20,7 @@ const Harness = () => {
describe("useDateFilterNavigation", () => {
it("preserves unrelated query parameters while replacing the date filter", async () => {
render(
- <MemoryRouter initialEntries={["/u/steven?sort=displayTime&filter=tagSearch%3Awork"]}>
+ <MemoryRouter initialEntries={["/?creator=steven&sort=displayTime&filter=tagSearch%3Awork"]}>
<MemoFilterProvider>
<Harness />
</MemoFilterProvider>
@@ -32,6 +32,7 @@ describe("useDateFilterNavigation", () => {
await waitFor(() => {
const params = new URLSearchParams(screen.getByTestId("search").textContent ?? "");
expect(params.get("sort")).toBe("displayTime");
+ expect(params.get("creator")).toBe("steven");
expect(params.get("filter")).toContain("tagSearch:work");
expect(params.get("filter")).toContain("displayTime:2026-08-02");
});
diff --git a/web/tests/filtered-memo-stats.test.ts b/web/tests/filtered-memo-stats.test.ts
index 817df9d07..1949c8a61 100644
--- a/web/tests/filtered-memo-stats.test.ts
+++ b/web/tests/filtered-memo-stats.test.ts
@@ -116,7 +116,7 @@ describe("useFilteredMemoStats", () => {
setTimeBasis: vi.fn(),
});
- renderHook(() => useFilteredMemoStats({ userName: "users/test", context: "explore", enabled: false }), { wrapper });
+ renderHook(() => useFilteredMemoStats({ userName: "users/test", context: "collection", enabled: false }), { wrapper });
expect(useUserStats).toHaveBeenCalledWith("users/test", { enabled: false, filter: undefined });
expect(useAllUserStats).toHaveBeenCalledWith(expect.anything(), { enabled: false });
@@ -136,7 +136,7 @@ describe("useFilteredMemoStats", () => {
expect(useUserStats).toHaveBeenCalledWith("users/test", { enabled: true, filter });
});
- it("scopes Explore statistics and includes the Space audience", () => {
+ it("scopes collection statistics to a Space without excluding readable private memos", () => {
mockUseView.mockReturnValue({
timeBasis: "create_time",
orderByTimeAsc: false,
@@ -145,18 +145,18 @@ describe("useFilteredMemoStats", () => {
});
const filter = 'space == "spaces/product"';
- renderHook(() => useFilteredMemoStats({ context: "explore", filter }), { wrapper });
+ renderHook(() => useFilteredMemoStats({ context: "collection", filter }), { wrapper });
expect(useAllUserStats).toHaveBeenCalledWith(
{
state: State.NORMAL,
- filter: '(space == "spaces/product") && (visibility in ["PUBLIC", "PROTECTED", "SPACE"])',
+ filter,
},
{ enabled: true },
);
});
- it("includes authorized Space memos in All Explore statistics", () => {
+ it("leaves the creator and visibility filters to access control in the All collection", () => {
mockUseView.mockReturnValue({
timeBasis: "create_time",
orderByTimeAsc: false,
@@ -164,12 +164,12 @@ describe("useFilteredMemoStats", () => {
setTimeBasis: vi.fn(),
});
- renderHook(() => useFilteredMemoStats({ context: "explore" }), { wrapper });
+ renderHook(() => useFilteredMemoStats({ context: "collection" }), { wrapper });
expect(useAllUserStats).toHaveBeenCalledWith(
{
state: State.NORMAL,
- filter: '(visibility in ["PUBLIC", "PROTECTED", "SPACE"])',
+ filter: undefined,
},
{ enabled: true },
);
diff --git a/web/tests/global-memo-editor.test.tsx b/web/tests/global-memo-editor.test.tsx
index c5d69c38e..e764903f2 100644
--- a/web/tests/global-memo-editor.test.tsx
+++ b/web/tests/global-memo-editor.test.tsx
@@ -373,7 +373,7 @@ describe("GlobalMemoEditorProvider", () => {
});
it.each([
- "/u/steven",
+ "/?creator=steven",
"/archived",
"/inbox",
"/setting",
diff --git a/web/tests/guards.test.tsx b/web/tests/guards.test.tsx
index a270e84fa..4ae839f2b 100644
--- a/web/tests/guards.test.tsx
+++ b/web/tests/guards.test.tsx
@@ -19,13 +19,7 @@ vi.mock("@/contexts/InstanceContext", () => ({
}));
import useCurrentUser from "@/hooks/useCurrentUser";
-import {
- LandingRoute,
- RequireAuthRoute,
- RequireFullInitializationRoute,
- RequireGuestRoute,
- RequireInstanceInitializationRoute,
-} from "@/router/guards";
+import { RequireAuthRoute, RequireFullInitializationRoute, RequireGuestRoute, RequireInstanceInitializationRoute } from "@/router/guards";
const mockedUseCurrentUser = vi.mocked(useCurrentUser);
@@ -77,58 +71,6 @@ describe("initialization guards", () => {
});
});
-describe("LandingRoute", () => {
- it("renders the nested home page for an authenticated visitor at /", () => {
- mockedUseCurrentUser.mockReturnValue(fakeUser);
-
- renderAt(
- "/",
- <Routes>
- <Route path="/" element={<LandingRoute />}>
- <Route index element={<div data-testid="home">home</div>} />
- </Route>
- <Route path="/explore" element={<LocationProbe />} />
- </Routes>,
- );
-
- expect(screen.getByTestId("home")).toHaveTextContent("home");
- });
-
- it("sends an unauthenticated visitor from the entry to /explore", () => {
- mockedUseCurrentUser.mockReturnValue(undefined);
-
- renderAt(
- "/",
- <Routes>
- <Route path="/" element={<LandingRoute />}>
- <Route index element={<div data-testid="home">home</div>} />
- </Route>
- <Route path="/explore" element={<LocationProbe />} />
- </Routes>,
- );
-
- expect(screen.getByTestId("location").textContent).toBe("/explore");
- });
-
- it("preserves the query string and hash when redirecting an unauthenticated visitor", () => {
- // Covers the regression in issue #5846: bookmarks pointing at `/?filter=...`
- // must not drop their params on the trip through the landing redirect.
- mockedUseCurrentUser.mockReturnValue(undefined);
-
- renderAt(
- "/?filter=tag:work#latest",
- <Routes>
- <Route path="/" element={<LandingRoute />}>
- <Route index element={<div data-testid="home">home</div>} />
- </Route>
- <Route path="/explore" element={<LocationProbe />} />
- </Routes>,
- );
-
- expect(screen.getByTestId("location").textContent).toBe("/explore?filter=tag:work#latest");
- });
-});
-
describe("RequireAuthRoute", () => {
it("renders the protected content for authenticated users", () => {
mockedUseCurrentUser.mockReturnValue(fakeUser);
diff --git a/web/tests/home-loading-boundary.test.tsx b/web/tests/home-loading-boundary.test.tsx
index 107041e24..9130595ce 100644
--- a/web/tests/home-loading-boundary.test.tsx
+++ b/web/tests/home-loading-boundary.test.tsx
@@ -1,5 +1,5 @@
import { render, screen } from "@testing-library/react";
-import { describe, expect, it, vi } from "vitest";
+import { beforeEach, describe, expect, it, vi } from "vitest";
import Home from "@/pages/Home";
vi.mock("@/hooks/useMemoSuggestions", () => ({
@@ -8,8 +8,11 @@ vi.mock("@/hooks/useMemoSuggestions", () => ({
const state = vi.hoisted(() => ({
selectedSpaceName: undefined as string | undefined,
+ creatorUsername: undefined as string | undefined,
editorProps: undefined as Record<string, unknown> | undefined,
listProps: undefined as Record<string, unknown> | undefined,
+ memoViewProps: undefined as Record<string, unknown> | undefined,
+ filterOptions: undefined as Record<string, unknown> | undefined,
}));
vi.mock("@/components/MemoEditor", () => ({
@@ -20,7 +23,10 @@ vi.mock("@/components/MemoEditor", () => ({
}));
vi.mock("@/components/MemoView", () => ({
- default: () => <div data-testid="memo-view" />,
+ default: (props: Record<string, unknown>) => {
+ state.memoViewProps = props;
+ return <div data-testid="memo-view" />;
+ },
}));
vi.mock("@/components/PagedMemoList", () => ({
@@ -62,17 +68,27 @@ vi.mock("@/contexts/NewMemoContext", () => ({
vi.mock("@/contexts/SpaceContext", () => ({
useSpaceContext: () => ({
selectedSpaceName: state.selectedSpaceName,
- memoFilter: state.selectedSpaceName ? `space == "${state.selectedSpaceName}"` : undefined,
+ creatorUsername: state.creatorUsername,
+ memoFilter:
+ [
+ state.selectedSpaceName && `space == "${state.selectedSpaceName}"`,
+ state.creatorUsername && `creator == "users/${state.creatorUsername}"`,
+ ]
+ .filter(Boolean)
+ .join(" && ") || undefined,
}),
}));
vi.mock("@/hooks", () => ({
- useMemoFilters: () => "",
+ useMemoFilters: (options: Record<string, unknown>) => {
+ state.filterOptions = options;
+ return "";
+ },
useMemoSorting: () => ({ listSort: undefined, orderBy: "create_time desc" }),
}));
vi.mock("@/hooks/useCurrentUser", () => ({
- default: () => ({ name: "users/1" }),
+ default: () => ({ name: "users/steven", username: "steven" }),
}));
vi.mock("@/utils/i18n", () => ({
@@ -80,8 +96,15 @@ vi.mock("@/utils/i18n", () => ({
}));
describe("<Home>", () => {
- it("renders the editor and memo cards synchronously without blank placeholders", () => {
+ beforeEach(() => {
state.selectedSpaceName = undefined;
+ state.creatorUsername = undefined;
+ state.editorProps = undefined;
+ state.listProps = undefined;
+ state.memoViewProps = undefined;
+ state.filterOptions = undefined;
+ });
+ it("renders the editor and memo cards synchronously without blank placeholders", () => {
render(<Home />);
expect(screen.getByTestId("memo-editor")).toBeInTheDocument();
@@ -90,6 +113,16 @@ describe("<Home>", () => {
expect(state.editorProps).toMatchObject({ cacheKey: "home-memo-editor", defaultSpace: undefined });
expect(state.editorProps?.autoFocus).toEqual(expect.any(Function));
expect(state.editorProps?.suggestions).toEqual([{ id: "tag:work" }]);
+ expect(state.filterOptions).not.toHaveProperty("creatorName");
+ expect(state.memoViewProps).toMatchObject({ showCreator: true });
+ });
+
+ it("shows another creator's matching memos without offering an editor", () => {
+ state.creatorUsername = "alice";
+ render(<Home />);
+ expect(state.listProps).toMatchObject({ contextFilter: 'creator == "users/alice"' });
+ expect(state.memoViewProps).toMatchObject({ showCreator: false });
+ expect(screen.queryByTestId("memo-editor")).not.toBeInTheDocument();
});
it("filters the feed and sets new memo placement to the selected Space", () => {
diff --git a/web/tests/legacy-profile-redirect.test.tsx b/web/tests/legacy-profile-redirect.test.tsx
new file mode 100644
index 000000000..9d6ff57a0
--- /dev/null
+++ b/web/tests/legacy-profile-redirect.test.tsx
@@ -0,0 +1,28 @@
+import { render, screen } from "@testing-library/react";
+import { MemoryRouter, Route, Routes, useLocation } from "react-router-dom";
+import { describe, expect, it } from "vitest";
+import { LegacyProfileRedirect } from "@/router/LegacyProfileRedirect";
+
+const HomeLocation = () => {
+ const location = useLocation();
+ return <span data-testid="location">{`${location.pathname}${location.search}${location.hash}`}</span>;
+};
+
+describe("legacy profile links", () => {
+ it.each([
+ ["/u/alice", "/?creator=alice"],
+ ["/u/j%C3%BAlia?filter=tagSearch%3Awork#memo", "/?filter=tagSearch%3Awork&creator=j%C3%BAlia#memo"],
+ ["/u/alice?creator=bob", "/?creator=alice"],
+ ])("redirects %s to %s", (source, expected) => {
+ render(
+ <MemoryRouter initialEntries={[source]}>
+ <Routes>
+ <Route path="/u/:username" element={<LegacyProfileRedirect />} />
+ <Route path="/" element={<HomeLocation />} />
+ </Routes>
+ </MemoryRouter>,
+ );
+
+ expect(screen.getByTestId("location")).toHaveTextContent(expected);
+ });
+});
diff --git a/web/tests/map-memos.test.tsx b/web/tests/map-memos.test.tsx
index 9919a4c3a..e5206c098 100644
--- a/web/tests/map-memos.test.tsx
+++ b/web/tests/map-memos.test.tsx
@@ -46,7 +46,7 @@ describe("map pagination", () => {
expect(state.list.mock.calls.map(([request]) => request.pageToken)).toEqual(["", "second", "third"]);
const request = state.list.mock.calls[0][0];
expect(request.pageSize).toBe(500);
- expect(request.filter).toContain('creator == "users/qa"');
+ expect(request.filter).not.toContain('creator == "users/qa"');
expect(request.filter).toContain('space == "spaces/travel"');
expect(request.filter).toContain("has_location");
});
diff --git a/web/tests/map-routes.test.ts b/web/tests/map-routes.test.ts
index 91d481ce7..16c329bbf 100644
--- a/web/tests/map-routes.test.ts
+++ b/web/tests/map-routes.test.ts
@@ -16,8 +16,16 @@ describe("map navigation", () => {
expect(resolveMemoDetailOrigin(createMemoNavigationState(`/map${search}`))).toBe(`/map${search}`);
expect(withMemoFilter(`/map${search}`, "tagSearch:food")).toContain("lat=35&lng=135&zoom=14&memo=memos%2Fone&filter=tagSearch%3Afood");
});
- it("sends Quick Find to Home within the active collection", () => {
- expect(getRouteActionPolicy("/map")).toEqual({ searchScope: "route-collection", searchDestination: "/" });
- expect(getRouteActionPolicy("/spaces/travel/map")).toEqual({ searchScope: "route-collection", searchDestination: "/spaces/travel" });
+ it("sends Quick Find to the matching feed within the active collection", () => {
+ expect(getRouteActionPolicy("/map")).toEqual({ searchScope: "route-collection", searchDestination: "/explore" });
+ expect(getRouteActionPolicy("/map", "?creator=steven")).toEqual({ searchScope: "route-collection", searchDestination: "/" });
+ expect(getRouteActionPolicy("/spaces/travel/map")).toEqual({
+ searchScope: "route-collection",
+ searchDestination: "/spaces/travel/explore",
+ });
+ expect(getRouteActionPolicy("/spaces/travel/map", "?creator=steven")).toEqual({
+ searchScope: "route-collection",
+ searchDestination: "/spaces/travel",
+ });
});
});
diff --git a/web/tests/memo-display-setting-menu.test.tsx b/web/tests/memo-display-setting-menu.test.tsx
index a887851f5..64ade8726 100644
--- a/web/tests/memo-display-setting-menu.test.tsx
+++ b/web/tests/memo-display-setting-menu.test.tsx
@@ -8,6 +8,7 @@ import { ViewProvider } from "@/contexts/ViewContext";
vi.mock("@/utils/i18n", () => ({
useTranslate: () => (key: string, params?: Record<string, number>) => {
const labels: Record<string, string> = {
+ "common.timeline": "Timeline",
"common.created-at": "Created",
"common.last-updated-at": "Last updated",
"memo.compact-mode": "Compact mode",
@@ -43,8 +44,9 @@ describe("MemoDisplaySettingMenu", () => {
</ViewProvider>,
);
- const trigger = screen.getByRole("button", { name: "View options" });
- expect(trigger).toHaveClass("size-6", "rounded-md", "text-muted-foreground/70", "hover:bg-muted/60", "hover:text-foreground");
+ const trigger = screen.getByRole("button", { name: "Timeline · View options" });
+ expect(trigger).toHaveClass("size-7", "w-auto", "px-1.5", "rounded-s-none");
+ expect(trigger.querySelector(".lucide-chevron-down")).toBeInTheDocument();
expect(trigger.querySelector("svg")).toHaveClass(SIDEBAR_SECTION_ACTION_ICON_CLASSES);
fireEvent.click(trigger);
@@ -60,6 +62,24 @@ describe("MemoDisplaySettingMenu", () => {
expect(screen.getByText("Grid layouts always use compact cards.")).toBeInTheDocument();
});
+ it("opens only from the arrow, not the adjacent Timeline link", () => {
+ render(
+ <ViewProvider>
+ <div>
+ <a href="#timeline">Timeline</a>
+ <MemoDisplaySettingMenu />
+ </div>
+ </ViewProvider>,
+ );
+ const trigger = screen.getByRole("button", { name: "Timeline · View options" });
+ fireEvent.click(screen.getByRole("link", { name: "Timeline" }));
+ expect(trigger).toHaveAttribute("aria-expanded", "false");
+ expect(screen.queryByRole("radiogroup", { name: "Layout" })).not.toBeInTheDocument();
+ fireEvent.click(trigger);
+ expect(trigger).toHaveAttribute("aria-expanded", "true");
+ expect(screen.getByRole("radiogroup", { name: "Layout" })).toBeInTheDocument();
+ });
+
it("moves horizontally in the visual direction for RTL layouts", () => {
render(
<DirectionProvider direction="rtl">
@@ -69,7 +89,7 @@ describe("MemoDisplaySettingMenu", () => {
</DirectionProvider>,
);
- fireEvent.click(screen.getByRole("button", { name: "View options" }));
+ fireEvent.click(screen.getByRole("button", { name: "Timeline · View options" }));
fireEvent.keyDown(screen.getByRole("radiogroup", { name: "Layout" }), { key: "ArrowLeft" });
expect(screen.getByRole("radio", { name: "2 columns" })).toBeChecked();
diff --git a/web/tests/memo-header-navigation.test.tsx b/web/tests/memo-header-navigation.test.tsx
index 30939c6ca..8c3e5b8e5 100644
--- a/web/tests/memo-header-navigation.test.tsx
+++ b/web/tests/memo-header-navigation.test.tsx
@@ -123,6 +123,7 @@ describe("MemoHeader navigation", () => {
);
const timestamp = screen.getByRole("button", { name: "time" });
+ if (showCreator) expect(screen.getByRole("link", { name: /Alice/ })).toHaveAttribute("href", "/?creator=alice");
timestamp.focus();
expect(timestamp).toHaveFocus();
diff --git a/web/tests/memo-markdown-memoization.test.tsx b/web/tests/memo-markdown-memoization.test.tsx
index ceed96331..a52d664fd 100644
--- a/web/tests/memo-markdown-memoization.test.tsx
+++ b/web/tests/memo-markdown-memoization.test.tsx
@@ -1,4 +1,4 @@
-import { render } from "@testing-library/react";
+import { render, screen } from "@testing-library/react";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { MemoMarkdownRenderer } from "@/components/MemoContent/MemoMarkdownRenderer";
import { hasMathSyntax } from "@/components/MemoContent/math";
@@ -30,5 +30,6 @@ describe("<MemoMarkdownRenderer /> memoization", () => {
rerender(<MemoMarkdownRenderer content="Hello @alice" memoName="memos/1" resolvedMentionUsernames={new Set(["alice"])} />);
expect(hasMathSyntax).toHaveBeenCalledTimes(2);
+ expect(screen.getByRole("link", { name: "@alice" })).toHaveAttribute("href", "/?creator=alice");
});
});
diff --git a/web/tests/memo-tag-navigation.test.tsx b/web/tests/memo-tag-navigation.test.tsx
index 461baa6b2..3852cb85b 100644
--- a/web/tests/memo-tag-navigation.test.tsx
+++ b/web/tests/memo-tag-navigation.test.tsx
@@ -47,8 +47,8 @@ describe("Memo tag navigation", () => {
expect(navigateTo).toHaveBeenCalledWith("/?filter=tagSearch%3Awork");
});
- it("returns a Profile-origin tag to that profile's memo list", () => {
- origin.parentPage = "/u/alice";
+ it("returns a creator-scoped tag to that creator's memo list", () => {
+ origin.parentPage = "/?creator=alice";
render(
<MemoryRouter initialEntries={["/memos/parent"]}>
@@ -57,6 +57,6 @@ describe("Memo tag navigation", () => {
);
fireEvent.click(screen.getByText("#work"));
- expect(navigateTo).toHaveBeenCalledWith("/u/alice?filter=tagSearch%3Awork");
+ expect(navigateTo).toHaveBeenCalledWith("/?creator=alice&filter=tagSearch%3Awork");
});
});
diff --git a/web/tests/memo-view-navigation.test.ts b/web/tests/memo-view-navigation.test.ts
index b8ba2aa48..415f8f256 100644
--- a/web/tests/memo-view-navigation.test.ts
+++ b/web/tests/memo-view-navigation.test.ts
@@ -30,9 +30,9 @@ describe("memo view navigation", () => {
).toBe("/explore?filter=contentSearch%3Aroadmap");
});
- it("keeps a filtered Profile origin intact", () => {
- expect(resolveMemoParentPage({ pathname: "/u/alice", search: "?filter=tagSearch%3Awork", memoName: "memos/123" })).toBe(
- "/u/alice?filter=tagSearch%3Awork",
+ it("keeps a filtered creator collection origin intact", () => {
+ expect(resolveMemoParentPage({ pathname: "/", search: "?creator=alice&filter=tagSearch%3Awork", memoName: "memos/123" })).toBe(
+ "/?creator=alice&filter=tagSearch%3Awork",
);
});
@@ -46,7 +46,7 @@ describe("memo view navigation", () => {
});
it("keeps an explicit origin ahead of the archived fallback", () => {
- expect(resolveMemoDetailOrigin(createMemoNavigationState("/u/alice"), { memoArchived: true })).toBe("/u/alice");
+ expect(resolveMemoDetailOrigin(createMemoNavigationState("/?creator=alice"), { memoArchived: true })).toBe("/?creator=alice");
});
it("round-trips an explicit origin through router state", () => {
@@ -88,12 +88,12 @@ describe("memo view navigation", () => {
});
it("replaces the filter without dropping other origin query parameters", () => {
- expect(withMemoFilter("/u/alice?sort=displayTime&filter=old#section", "tagSearch:design")).toBe(
- "/u/alice?sort=displayTime&filter=tagSearch%3Adesign",
+ expect(withMemoFilter("/?creator=alice&sort=displayTime&filter=old#section", "tagSearch:design")).toBe(
+ "/?creator=alice&sort=displayTime&filter=tagSearch%3Adesign",
);
});
- it("applies a filter within the originating Profile", () => {
- expect(withMemoFilter("/u/alice", "tagSearch:design")).toBe("/u/alice?filter=tagSearch%3Adesign");
+ it("applies a filter within the originating creator collection", () => {
+ expect(withMemoFilter("/?creator=alice", "tagSearch:design")).toBe("/?creator=alice&filter=tagSearch%3Adesign");
});
});
diff --git a/web/tests/memo-views.test.ts b/web/tests/memo-views.test.ts
index a743766d7..0f7877248 100644
--- a/web/tests/memo-views.test.ts
+++ b/web/tests/memo-views.test.ts
@@ -4,9 +4,7 @@ import { combineCELFilters } from "@/lib/cel-filter";
import {
BUILTIN_TASKS_VIEW_FILTER,
BUILTIN_TASKS_VIEW_ID,
- getMemoScopePath,
getMemoViewId,
- getProfileUsername,
isMemoCollectionRoute,
isMemoScopeRoute,
resolveMemoScope,
@@ -14,35 +12,29 @@ import {
import { Visibility } from "@/types/proto/api/v1/memo_service_pb";
describe("memo scopes", () => {
- it("resolves collection, profile, and detail routes", () => {
+ it("resolves collection and detail routes", () => {
expect(resolveMemoScope("/archived")).toBe("archived");
expect(resolveMemoScope("/explore")).toBe("explore");
- expect(resolveMemoScope("/u/steven", { currentUsername: "steven" })).toBe("home");
- expect(resolveMemoScope("/u/maya", { currentUsername: "steven" })).toBe("explore");
expect(resolveMemoScope("/memos/123", { detailFrom: "/archived?filter=tagSearch%3Awork" })).toBe("archived");
expect(resolveMemoScope("/memos/123", { memoArchived: true })).toBe("archived");
expect(resolveMemoScope("/settings", { fallback: "explore" })).toBe("explore");
});
- it("maps collection routes while limiting primary scope paths to Home and Explore", () => {
+ it("recognizes Home, Archived, and the legacy Explore alias", () => {
expect(isMemoScopeRoute("/")).toBe(true);
expect(isMemoScopeRoute("/explore")).toBe(true);
expect(isMemoScopeRoute("/archived")).toBe(true);
expect(isMemoScopeRoute("/attachments")).toBe(false);
- expect(getMemoScopePath("home")).toBe("/");
- expect(getMemoScopePath("explore")).toBe("/explore");
});
- it("treats user profiles as collection routes where views and filters apply in place", () => {
+ it("treats Home and calendar as collection routes where views and filters apply in place", () => {
expect(isMemoCollectionRoute("/")).toBe(true);
expect(isMemoCollectionRoute("/archived")).toBe(true);
- expect(isMemoCollectionRoute("/u/steven")).toBe(true);
- expect(isMemoCollectionRoute("/u/steven/?filter=tagSearch%3Awork")).toBe(true);
+ expect(isMemoCollectionRoute("/?creator=steven")).toBe(true);
+ expect(isMemoCollectionRoute("/u/steven")).toBe(false);
expect(isMemoCollectionRoute("/calendar")).toBe(true);
expect(isMemoCollectionRoute("/Calendar/2026/08/02/")).toBe(true);
expect(isMemoCollectionRoute("/calendars")).toBe(false);
- expect(getProfileUsername("/u/j%C3%BAlia/")).toBe("júlia");
- expect(getProfileUsername("/u/steven/memos")).toBeUndefined();
expect(isMemoScopeRoute("/u/steven")).toBe(false);
expect(isMemoCollectionRoute("/memos/123")).toBe(false);
expect(isMemoCollectionRoute("/attachments")).toBe(false);
diff --git a/web/tests/quick-find-navigation.test.tsx b/web/tests/quick-find-navigation.test.tsx
index 9da1ef2fa..838142beb 100644
--- a/web/tests/quick-find-navigation.test.tsx
+++ b/web/tests/quick-find-navigation.test.tsx
@@ -169,7 +169,7 @@ describe("Quick Find navigation", () => {
expect(state.filters.filter((filter) => !predicate(filter))).toEqual([{ factor: "tagSearch", value: "work" }]);
});
- it("searches from Inbox into global Home in one history step", async () => {
+ it("searches from Inbox into global Explore in one history step", async () => {
const router = renderSearch("/inbox");
expect(screen.getByTestId("scope")).toHaveTextContent("all");
@@ -178,7 +178,7 @@ describe("Quick Find navigation", () => {
fireEvent.change(input, { target: { value: "roadmap" } });
fireEvent.submit(input.closest("form")!);
- await waitFor(() => expect(screen.getByTestId("path")).toHaveTextContent("/?filter=contentSearch%3Aroadmap"));
+ await waitFor(() => expect(screen.getByTestId("path")).toHaveTextContent("/explore?filter=contentSearch%3Aroadmap"));
expect(state.setFilters).not.toHaveBeenCalled();
expect(screen.getByTestId("scope")).toHaveTextContent("all");
@@ -222,7 +222,7 @@ describe("Quick Find navigation", () => {
fireEvent.change(input, { target: { value: "roadmap" } });
fireEvent.submit(input.closest("form")!);
- await waitFor(() => expect(screen.getByTestId("path")).toHaveTextContent("/?filter=contentSearch%3Aroadmap"));
+ await waitFor(() => expect(screen.getByTestId("path")).toHaveTextContent("/explore?filter=contentSearch%3Aroadmap"));
await act(async () => {
await router.navigate(-1);
diff --git a/web/tests/quick-find.test.ts b/web/tests/quick-find.test.ts
index 6ee5ccd27..4d6add282 100644
--- a/web/tests/quick-find.test.ts
+++ b/web/tests/quick-find.test.ts
@@ -86,7 +86,7 @@ describe("Quick Find", () => {
{ factor: "displayTime", value: "2026-08-03" },
{ factor: "contentSearch", value: "project" },
],
- destination: "/?filter=tagSearch%3Awork%2CdisplayTime%3A2026-08-03%2CcontentSearch%3Aproject",
+ destination: "/explore?filter=tagSearch%3Awork%2CdisplayTime%3A2026-08-03%2CcontentSearch%3Aproject",
});
});
@@ -97,18 +97,7 @@ describe("Quick Find", () => {
{ factor: "displayTime", value: "2026-08-03" },
{ factor: "contentSearch", value: "project" },
],
- destination: "/?filter=tagSearch%3Awork%2CdisplayTime%3A2026-08-03%2CcontentSearch%3Aproject",
- });
- });
-
- it("keeps Profile search on the Profile and returns its map tab to the memo list", () => {
- expect(resolveQuickFindSubmission("/u/steven", "project", scopedFilters, "text")).toEqual({
- filters: [
- { factor: "tagSearch", value: "work" },
- { factor: "displayTime", value: "2026-08-03" },
- { factor: "contentSearch", value: "project" },
- ],
- destination: "/u/steven?filter=tagSearch%3Awork%2CdisplayTime%3A2026-08-03%2CcontentSearch%3Aproject",
+ destination: "/explore?filter=tagSearch%3Awork%2CdisplayTime%3A2026-08-03%2CcontentSearch%3Aproject",
});
});
@@ -123,7 +112,7 @@ describe("Quick Find", () => {
])("starts a clean All search from %s", (pathname) => {
expect(resolveQuickFindSubmission(pathname, "project", scopedFilters, "text")).toEqual({
filters: [{ factor: "contentSearch", value: "project" }],
- destination: "/?filter=contentSearch%3Aproject",
+ destination: "/explore?filter=contentSearch%3Aproject",
});
});
diff --git a/web/tests/sidebar-row-state.test.tsx b/web/tests/sidebar-row-state.test.tsx
index 95dce8afb..5fd6d2f98 100644
--- a/web/tests/sidebar-row-state.test.tsx
+++ b/web/tests/sidebar-row-state.test.tsx
@@ -94,8 +94,8 @@ describe("MemoFilters", () => {
expect(screen.getByText("Last week")).toBeInTheDocument();
});
- it("announces a view on a user profile, where it narrows that user's memos", () => {
- renderChips("/u/alice", BUILTIN_TASKS_VIEW_ID);
+ it("announces a view on a creator collection, where it narrows that user's memos", () => {
+ renderChips("/?creator=alice", BUILTIN_TASKS_VIEW_ID);
expect(screen.getByText("common.tasks")).toBeInTheDocument();
});
diff --git a/web/tests/space-context.test.tsx b/web/tests/space-context.test.tsx
index 20adb8681..02861c410 100644
--- a/web/tests/space-context.test.tsx
+++ b/web/tests/space-context.test.tsx
@@ -12,7 +12,7 @@ const state = vi.hoisted(() => ({
],
ready: true,
}));
-vi.mock("@/hooks/useCurrentUser", () => ({ default: () => ({ name: state.user }) }));
+vi.mock("@/hooks/useCurrentUser", () => ({ default: () => ({ name: state.user, username: state.user.slice("users/".length) }) }));
vi.mock("@/hooks/useSpaceQueries", () => ({
useSpaces: () => ({ data: state.spaces, isPending: false, isError: false }),
useSpace: (_user: string, name?: string) => ({
@@ -65,6 +65,23 @@ describe("URL-owned Space context", () => {
expect(screen.getByTestId("space")).toHaveTextContent("all");
expect(screen.getByTestId("filter")).toHaveTextContent("all");
});
+ it("filters Home to the signed-in creator, including inside a Space", () => {
+ setup("/spaces/a");
+ expect(screen.getByTestId("filter")).toHaveTextContent('creator == "users/alice"');
+ expect(screen.getByTestId("filter")).toHaveTextContent('space == "spaces/a"');
+ });
+ it("keeps Space Explore across all readable creators", () => {
+ setup("/spaces/a/explore");
+ expect(screen.getByTestId("filter")).toHaveTextContent('space == "spaces/a"');
+ expect(screen.getByTestId("filter")).not.toHaveTextContent("creator ==");
+ });
+ it("combines creator and Space filters from the collection URL", () => {
+ setup("/spaces/a?creator=bob");
+ expect(screen.getByTestId("filter")).toHaveTextContent('space == "spaces/a"');
+ expect(screen.getByTestId("filter")).toHaveTextContent('creator == "users/bob"');
+ fireEvent.click(screen.getByText("B"));
+ expect(screen.getByTestId("path")).toHaveTextContent("/spaces/b?creator=bob");
+ });
it("restores Space from a deep link before metadata has loaded", () => {
state.ready = false;
setup("/spaces/a/calendar/2026/09/06");
diff --git a/web/tests/space-feed-pages.test.tsx b/web/tests/space-feed-pages.test.tsx
index e030aa19e..319fba45a 100644
--- a/web/tests/space-feed-pages.test.tsx
+++ b/web/tests/space-feed-pages.test.tsx
@@ -1,102 +1,49 @@
import { render, screen } from "@testing-library/react";
-import { beforeEach, describe, expect, it, vi } from "vitest";
+import { describe, expect, it, vi } from "vitest";
import Archived from "@/pages/Archived";
-import Explore from "@/pages/Explore";
-import { Visibility } from "@/types/proto/api/v1/memo_service_pb";
const state = vi.hoisted(() => ({
- selectedSpaceName: undefined as string | undefined,
- memoFilter: undefined as string | undefined,
- listProps: [] as Array<Record<string, unknown>>,
- memoViewProps: [] as Array<Record<string, unknown>>,
- filterOptions: [] as Array<Record<string, unknown>>,
+ listProps: undefined as Record<string, unknown> | undefined,
+ memoViewProps: undefined as Record<string, unknown> | undefined,
+ filterOptions: undefined as Record<string, unknown> | undefined,
}));
vi.mock("@/components/MemoView", () => ({
default: (props: Record<string, unknown>) => {
- state.memoViewProps.push(props);
+ state.memoViewProps = props;
return <div />;
},
}));
-
vi.mock("@/components/PagedMemoList", () => ({
default: (props: Record<string, unknown>) => {
- state.listProps.push(props);
- const renderLeading = props.renderLeading as ((options: { useGrid: boolean }) => React.ReactNode) | undefined;
- const renderer = props.renderer as
- | ((memo: { name: string; space: string }, options: { compact: boolean }) => React.ReactNode)
- | undefined;
+ state.listProps = props;
+ const renderLeading = props.renderLeading as (options: { useGrid: boolean }) => React.ReactNode;
+ const renderer = props.renderer as (memo: { name: string }, options: { compact: boolean }) => React.ReactNode;
return (
<div>
- {renderLeading?.({ useGrid: false })}
- {renderer?.({ name: "memos/test", space: "spaces/product" }, { compact: false })}
+ {renderLeading({ useGrid: false })}
+ {renderer({ name: "memos/test" }, { compact: false })}
</div>
);
},
getMemoKey: (memo: { name: string }) => memo.name,
}));
-
-vi.mock("@/contexts/SpaceContext", () => ({
- useSpaceContext: () => ({ selectedSpaceName: state.selectedSpaceName, memoFilter: state.memoFilter }),
-}));
-
vi.mock("@/hooks", () => ({
useMemoFilters: (options: Record<string, unknown>) => {
- state.filterOptions.push(options);
+ state.filterOptions = options;
return "filter";
},
useMemoSorting: () => ({ listSort: undefined, orderBy: "create_time desc" }),
}));
+vi.mock("@/hooks/useCurrentUser", () => ({ default: () => ({ name: "users/test" }) }));
+vi.mock("@/utils/i18n", () => ({ useTranslate: () => (key: string) => key }));
-vi.mock("@/hooks/useCurrentUser", () => ({
- default: () => ({ name: "users/test" }),
-}));
-
-describe("Memo feed collection scope", () => {
- beforeEach(() => {
- state.selectedSpaceName = undefined;
- state.memoFilter = undefined;
- state.listProps = [];
- state.memoViewProps = [];
- state.filterOptions = [];
- });
-
- it("uses the All collection without a Space filter for Explore and the user archive", () => {
- render(
- <>
- <Explore />
- <Archived />
- </>,
- );
-
- expect(state.listProps).toHaveLength(2);
- expect(state.listProps[0]).toMatchObject({ contextFilter: undefined });
- expect(state.listProps[1]).not.toHaveProperty("contextFilter");
- expect(state.filterOptions[0]).toMatchObject({
- visibilities: [Visibility.PUBLIC, Visibility.PROTECTED, Visibility.SPACE],
- });
- expect(state.memoViewProps).toEqual([expect.objectContaining({ showSpace: true }), expect.objectContaining({ showSpace: true })]);
- expect(screen.getByRole("heading", { level: 1 })).toHaveTextContent("Archived");
- });
-
- it("uses the selected Space filter and includes its member audience in Explore", () => {
- state.selectedSpaceName = "spaces/product";
- state.memoFilter = 'space == "spaces/product"';
- render(<Explore />);
-
- expect(state.listProps[0]).toMatchObject({ contextFilter: 'space == "spaces/product"' });
- expect(state.filterOptions[0]).toMatchObject({
- visibilities: [Visibility.PUBLIC, Visibility.PROTECTED, Visibility.SPACE],
- });
- expect(state.memoViewProps[0]).toMatchObject({ showSpace: false });
- });
-
- it("keeps Archived independent of a remembered Space", () => {
- state.selectedSpaceName = "spaces/product";
- state.memoFilter = 'space == "spaces/product"';
+describe("Archived feed", () => {
+ it("stays limited to the signed-in creator and does not inherit Space", () => {
render(<Archived />);
-
- expect(state.listProps[0]).not.toHaveProperty("contextFilter");
- expect(state.memoViewProps[0]).toMatchObject({ showSpace: true });
+ expect(state.listProps).not.toHaveProperty("contextFilter");
+ expect(state.filterOptions).toMatchObject({ creatorName: "users/test" });
+ expect(state.memoViewProps).toMatchObject({ showSpace: true });
+ expect(screen.getByRole("heading", { level: 1 })).toHaveTextContent("common.archived");
});
});
diff --git a/web/tests/space-routes.test.tsx b/web/tests/space-routes.test.tsx
index 78552782c..aee84d93e 100644
--- a/web/tests/space-routes.test.tsx
+++ b/web/tests/space-routes.test.tsx
@@ -7,7 +7,14 @@ import { getRouteActionPolicy, getSidebarRouteKind } from "@/components/AppSideb
import { CalendarHeader } from "@/components/CalendarView/CalendarHeader";
import { resolveMemoDetailOrigin, resolveMemoParentPage } from "@/components/MemoView/navigation";
import Calendar from "@/pages/Calendar";
-import { buildCollectionPath, getSpaceSwitchPath, resolveCollectionRoute } from "@/router/routes";
+import {
+ buildCollectionPath,
+ collectionNavigationPath,
+ getCreatorHomePath,
+ getCreatorSwitchPath,
+ getSpaceSwitchPath,
+ resolveCollectionRoute,
+} from "@/router/routes";
import { SpaceRoute } from "@/router/SpaceRoute";
const state = vi.hoisted(() => ({
@@ -50,11 +57,51 @@ describe("Space route contract", () => {
);
expect(getSpaceSwitchPath({ pathname: "/setting", search: "?section=spaces" }, "spaces/b")).toBe("/spaces/b");
});
- it("searches from calendar and attachments into the same Space Home", () => {
+ it("combines creator and Space independently across collection views", () => {
+ const location = { pathname: "/spaces/a/calendar/2026/09", search: "?creator=alice&filter=tagSearch%3Awork" };
+ expect(getCreatorSwitchPath(location, "steven")).toBe("/spaces/a/calendar/2026/09?creator=steven&filter=tagSearch%3Awork");
+ expect(getCreatorSwitchPath(location)).toBe("/spaces/a/calendar/2026/09?filter=tagSearch%3Awork");
+ expect(getSpaceSwitchPath(location, "spaces/b")).toBe("/spaces/b/calendar/2026/09?creator=alice&filter=tagSearch%3Awork");
+ expect(collectionNavigationPath("/attachments", location)).toBe("/spaces/a/attachments?filter=tagSearch%3Awork&creator=alice");
+ expect(getCreatorHomePath("alice")).toBe("/?creator=alice");
+ expect(getCreatorHomePath("júlia")).toBe("/?creator=j%C3%BAlia");
+ });
+ it("keeps personal Home and all-creator Explore distinct while changing views", () => {
+ expect(getCreatorSwitchPath({ pathname: "/", search: "?filter=tagSearch%3Awork" })).toBe("/explore?filter=tagSearch%3Awork");
+ expect(getCreatorSwitchPath({ pathname: "/spaces/a/explore", search: "" }, "alice", "alice")).toBe("/spaces/a");
+ expect(collectionNavigationPath("/calendar", { pathname: "/", search: "" }, "alice")).toBe("/calendar?creator=alice");
+ expect(collectionNavigationPath("/calendar", { pathname: "/explore", search: "" }, "alice")).toBe("/calendar");
+ expect(collectionNavigationPath("/", { pathname: "/calendar", search: "" }, "alice")).toBe("/explore");
+ expect(collectionNavigationPath("/", { pathname: "/calendar", search: "?creator=alice" }, "alice")).toBe("/");
+ });
+ it.each(["/", "/calendar", "/map", "/attachments"])("preserves collection filters when navigating to %s", (destination) => {
+ const filter = "tagSearch:work,contentSearch:a%26b,celSearch:visibility%20%3D%3D%20%22PUBLIC%22";
+ const search = `?${new URLSearchParams({ creator: "alice", filter, lat: "31", lng: "121", zoom: "12", memo: "memos/a" })}`;
+ const path = collectionNavigationPath(destination, { pathname: "/spaces/a/map", search }, "steven");
+ const url = new URL(path, "https://memos.test");
+ expect(url.pathname).toBe(destination === "/" ? "/spaces/a" : `/spaces/a${destination}`);
+ expect(Object.fromEntries(url.searchParams)).toEqual({ filter, creator: "alice" });
+ });
+ it.each([
+ ["/", "/calendar", "/calendar?filter=tagSearch%3Awork&creator=alice"],
+ ["/explore", "/calendar", "/calendar?filter=tagSearch%3Awork"],
+ ["/calendar", "/", "/explore?filter=tagSearch%3Awork"],
+ ])("carries filters from %s to %s without changing personal or Explore scope", (pathname, destination, expected) => {
+ expect(collectionNavigationPath(destination, { pathname, search: "?filter=tagSearch%3Awork" }, "alice")).toBe(expected);
+ });
+ it("does not carry filters from non-collection pages", () => {
+ expect(collectionNavigationPath("/calendar", { pathname: "/setting", search: "?filter=tagSearch%3Awork" }, "alice")).toBe(
+ "/calendar?creator=alice",
+ );
+ });
+ it("searches from All calendar and attachments into Space Explore", () => {
for (const path of ["/spaces/a/calendar/2026/09", "/spaces/a/attachments"]) {
- expect(resolveQuickFindSubmission(path, "roadmap", [], "text").destination).toBe("/spaces/a?filter=contentSearch%3Aroadmap");
+ expect(resolveQuickFindSubmission(path, "roadmap", [], "text").destination).toBe("/spaces/a/explore?filter=contentSearch%3Aroadmap");
}
- expect(getRouteActionPolicy("/memos/a").searchDestination).toBe("/");
+ expect(getRouteActionPolicy("/memos/a").searchDestination).toBe("/explore");
+ expect(resolveQuickFindSubmission("/spaces/a/calendar", "roadmap", [], "text", "?creator=alice").destination).toBe(
+ "/spaces/a?filter=contentSearch%3Aroadmap&creator=alice",
+ );
});
it("carries the full calendar origin through a permanent memo link", () => {
const parentPage = "/spaces/a/calendar/2026/09/06?filter=tagSearch%3Awork";
diff --git a/web/tests/space-switcher.test.tsx b/web/tests/space-switcher.test.tsx
index 8f3d7a19f..621571bb4 100644
--- a/web/tests/space-switcher.test.tsx
+++ b/web/tests/space-switcher.test.tsx
@@ -1,9 +1,13 @@
-import { createEvent, fireEvent, screen, render as testingRender, waitFor, within } from "@testing-library/react";
-import { createMemoryRouter, MemoryRouter, RouterProvider } from "react-router-dom";
+import { fireEvent, render, screen, waitFor, within } from "@testing-library/react";
+import { createMemoryRouter, RouterProvider, useLocation } from "react-router-dom";
import { beforeEach, describe, expect, it, vi } from "vitest";
import SpaceSwitcher from "@/components/AppSidebar/SpaceSwitcher";
+import { getCollectionCreator, ROUTES, resolveCollectionRoute } from "@/router/routes";
-const spaceState = vi.hoisted(() => ({
+const state = vi.hoisted(() => ({
+ currentUser: { name: "users/steven", username: "steven", displayName: "Steven", avatarUrl: "" } as
+ | { name: string; username: string; displayName: string; avatarUrl: string }
+ | undefined,
spaces: [
{ name: "spaces/product", title: "Product", description: "" },
{ name: "spaces/research", title: "Research", description: "" },
@@ -11,239 +15,209 @@ const spaceState = vi.hoisted(() => ({
selectedSpace: undefined as { name: string; title: string; description: string } | undefined,
selectedSpaceName: undefined as string | undefined,
selectSpace: vi.fn(),
+ setMobileOpen: vi.fn(),
}));
-vi.mock("@/components/MemosLogo", () => ({
- default: () => <span>Memos</span>,
+vi.mock("@/components/MemosLogo", () => ({ default: () => <span>Memos</span> }));
+vi.mock("@/components/UserMenu", () => ({
+ default: () => <button type="button">Steven account</button>,
+ UserPreferenceDialog: () => null,
}));
-
+vi.mock("@/hooks/useCurrentUser", () => ({
+ default: () => state.currentUser,
+}));
+vi.mock("@/hooks/useUserQueries", () => ({
+ useUser: () => ({ data: { name: "users/alice", username: "alice", displayName: "Alice", avatarUrl: "" } }),
+ useNotifications: () => ({ data: [] }),
+}));
+vi.mock("@/contexts/AppSidebarContext", () => ({ useAppSidebar: () => ({ setMobileOpen: state.setMobileOpen }) }));
vi.mock("@/components/CreateSpaceDialog", () => ({
- default: ({ open, onCreated }: { open: boolean; onCreated?: (space: (typeof spaceState.spaces)[number]) => void }) =>
+ default: ({ open, onCreated }: { open: boolean; onCreated?: (space: (typeof state.spaces)[number]) => void }) =>
open ? (
<div role="dialog">
- Create Space dialog
- <button type="button" onClick={() => onCreated?.(spaceState.spaces[0])}>
+ <button type="button" onClick={() => onCreated?.(state.spaces[0])}>
Complete create
</button>
</div>
) : null,
}));
-
vi.mock("@/contexts/SpaceContext", () => ({
useSpaceContext: () => {
- const duplicateSpaceTitles = new Set(
- spaceState.spaces
- .filter((space, index) => spaceState.spaces.findIndex((candidate) => candidate.title === space.title) !== index)
- .map((space) => space.title),
- );
+ const location = useLocation();
+ const route = resolveCollectionRoute(location.pathname);
return {
- ...spaceState,
- duplicateSpaceTitles,
+ ...state,
+ creatorUsername:
+ route.pathname === ROUTES.EXPLORE
+ ? undefined
+ : (getCollectionCreator(location.search) ?? (route.pathname === ROUTES.HOME ? state.currentUser?.username : undefined)),
+ duplicateSpaceTitles: new Set<string>(),
isLoadingSpaces: false,
isSpacesError: false,
};
},
}));
-
-vi.mock("@/utils/i18n", () => ({
- useTranslate: () => (key: string) => key,
+vi.mock("@/utils/i18n", async (importOriginal) => ({
+ ...(await importOriginal<typeof import("@/utils/i18n")>()),
+ useTranslate: () => (key: string, options?: { source: string }) => (options?.source ? `Back to ${options.source}` : key),
}));
-const render = (ui: React.ReactNode) => testingRender(<MemoryRouter>{ui}</MemoryRouter>);
+const renderAt = (path = "/", size: "md" | "header" = "md") => {
+ const router = createMemoryRouter(
+ [
+ {
+ path: "*",
+ element: (
+ <aside>
+ <SpaceSwitcher size={size} />
+ </aside>
+ ),
+ },
+ ],
+ { initialEntries: [path] },
+ );
+ render(<RouterProvider router={router} />);
+ return router;
+};
+
+const openSwitcher = () => fireEvent.click(screen.getByRole("button", { name: /space.switch:/ }));
describe("SpaceSwitcher", () => {
beforeEach(() => {
- spaceState.spaces = [
+ state.currentUser = { name: "users/steven", username: "steven", displayName: "Steven", avatarUrl: "" };
+ state.spaces = [
{ name: "spaces/product", title: "Product", description: "" },
{ name: "spaces/research", title: "Research", description: "" },
];
- spaceState.selectedSpace = undefined;
- spaceState.selectedSpaceName = undefined;
- spaceState.selectSpace.mockClear();
+ state.selectedSpace = undefined;
+ state.selectedSpaceName = undefined;
+ state.selectSpace.mockClear();
+ state.setMobileOpen.mockClear();
});
- it.each([
- "/",
- "/setting",
- "/memos/direct",
- ])("does not navigate the current scope from %s and leaves modified clicks native", async (path) => {
- const router = createMemoryRouter([{ path: "*", element: <SpaceSwitcher /> }], { initialEntries: [path] });
- testingRender(<RouterProvider router={router} />);
- const key = router.state.location.key;
- fireEvent.click(screen.getByRole("button", { name: "space.switch: common.memos" }));
- fireEvent.click(await screen.findByRole("menuitemradio", { name: "Memos" }));
- expect(router.state.location.key).toBe(key);
- await waitFor(() => expect(screen.queryByRole("menu")).not.toBeInTheDocument());
- fireEvent.click(screen.getByRole("button", { name: "space.switch: common.memos" }));
- const product = await screen.findByRole("menuitemradio", { name: "Product" });
- const click = createEvent.click(product, { ctrlKey: true, cancelable: true });
- fireEvent(product, click);
- expect(click.defaultPrevented).toBe(false);
- expect(router.state.location.pathname).toBe(path);
- });
-
- it("lists Memos, every available Space, and the create entry", async () => {
- render(<SpaceSwitcher />);
-
- const trigger = screen.getByRole("button", { name: "space.switch: common.memos" });
- expect(trigger).toHaveAttribute("aria-haspopup", "menu");
- expect(trigger).toHaveAttribute("aria-expanded", "false");
- fireEvent.click(trigger);
- expect(trigger).toHaveAttribute("aria-expanded", "true");
-
- expect(await screen.findByRole("menuitemradio", { name: "Memos" })).toHaveAttribute("aria-checked", "true");
- const productRow = screen.getByRole("menuitemradio", { name: "Product" });
- expect(productRow).toHaveAttribute("aria-checked", "false");
- expect(productRow.querySelector(".lucide-astroid")).not.toBeNull();
- expect(screen.getByRole("menuitemradio", { name: "Research" })).toBeInTheDocument();
- expect(screen.getByRole("menuitem", { name: "space.create" })).toBeInTheDocument();
+ it("shows an independent creator choice, a collapsed Space selector, and an icon create action", () => {
+ renderAt();
+ openSwitcher();
+ const userButton = screen.getByRole("link", { name: "common.home" });
+ const exploreButton = screen.getByRole("link", { name: "common.explore" });
+ expect(screen.getByRole("navigation", { name: "common.browse" })).toBeInTheDocument();
+ expect(exploreButton).not.toHaveAttribute("aria-current");
+ expect(userButton).toHaveAttribute("aria-current", "page");
+ expect(userButton.compareDocumentPosition(exploreButton) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
+ expect(screen.getByRole("combobox", { name: "space.switch" })).toHaveTextContent("space.all-spaces");
+ expect(screen.queryByText("Product")).not.toBeInTheDocument();
+ expect(screen.getByRole("button", { name: "space.create" })).toHaveAttribute("title", "space.create");
+ expect(screen.getByRole("button", { name: "Steven account" })).toBeInTheDocument();
});
- it("fits the popup symmetrically inside the sidebar rail", async () => {
- render(
- <aside>
- <SpaceSwitcher />
- </aside>,
- );
-
- const trigger = screen.getByRole("button", { name: "space.switch: common.memos" });
- const sidebar = trigger.closest("aside");
- expect(sidebar).not.toBeNull();
- vi.spyOn(sidebar as HTMLElement, "getBoundingClientRect").mockReturnValue({ left: 0, right: 223, width: 223 } as DOMRect);
- vi.spyOn(trigger, "getBoundingClientRect").mockReturnValue({ left: 12, right: 143, width: 131 } as DOMRect);
-
- fireEvent.click(trigger);
-
- expect(await screen.findByRole("menu")).toHaveStyle({ width: "199px" });
- });
-
- it("uses the same symmetric popup rail from the opposite inline edge", async () => {
- render(
- <aside>
- <SpaceSwitcher />
- </aside>,
- );
-
- const trigger = screen.getByRole("button", { name: "space.switch: common.memos" });
- const sidebar = trigger.closest("aside");
- expect(sidebar).not.toBeNull();
- vi.spyOn(sidebar as HTMLElement, "getBoundingClientRect").mockReturnValue({ left: 0, right: 223, width: 223 } as DOMRect);
- vi.spyOn(trigger, "getBoundingClientRect").mockReturnValue({ left: 80, right: 211, width: 131 } as DOMRect);
-
- fireEvent.click(trigger);
-
- expect(await screen.findByRole("menu")).toHaveStyle({ width: "199px" });
+ it("switches Home to Explore without closing the menu", () => {
+ const router = renderAt("/");
+ openSwitcher();
+ fireEvent.click(screen.getByRole("link", { name: "common.explore" }));
+ expect(router.state.location.pathname).toBe("/explore");
+ expect(screen.getByRole("dialog")).toBeInTheDocument();
+ expect(screen.getByRole("link", { name: "common.explore" })).toHaveAttribute("aria-current", "page");
+ fireEvent.click(screen.getByRole("link", { name: "common.home" }));
+ expect(router.state.location.pathname).toBe("/");
+ expect(router.state.location.search).toBe("");
+ expect(screen.getByRole("dialog")).toBeInTheDocument();
});
- it("marks exactly one context as active", async () => {
- spaceState.selectedSpaceName = "spaces/product";
- spaceState.selectedSpace = spaceState.spaces[0];
- render(<SpaceSwitcher />);
-
- fireEvent.click(screen.getByRole("button", { name: "space.switch: Product" }));
-
- const rows = await screen.findAllByRole("menuitemradio");
- expect(rows.map((row) => row.getAttribute("aria-checked"))).toEqual(["false", "true", "false"]);
-
- // The active row carries the fill; the check is its only indicator.
- const active = screen.getByRole("menuitemradio", { name: "Product" });
- expect(active.className).toContain("bg-accent/60");
- expect(active.querySelector(".lucide-check")).not.toBeNull();
- expect(screen.getByRole("menuitemradio", { name: "Research" }).querySelector(".lucide-check")).toBeNull();
+ it("changes creator while preserving the Space and other query parameters", () => {
+ state.selectedSpaceName = "spaces/product";
+ state.selectedSpace = state.spaces[0];
+ const router = renderAt("/spaces/product/calendar/2026/09?filter=tag%3Awork");
+ openSwitcher();
+ fireEvent.click(screen.getByRole("link", { name: "common.home" }));
+ expect(router.state.location.pathname).toBe("/spaces/product/calendar/2026/09");
+ expect(new URLSearchParams(router.state.location.search).get("creator")).toBe("steven");
+ expect(new URLSearchParams(router.state.location.search).get("filter")).toBe("tag:work");
+ expect(screen.getByRole("dialog")).toBeInTheDocument();
+ expect(screen.getByRole("link", { name: "common.home" })).toHaveAttribute("aria-current", "page");
+
+ fireEvent.click(screen.getByRole("link", { name: "common.explore" }));
+ expect(new URLSearchParams(router.state.location.search).get("creator")).toBeNull();
+ expect(new URLSearchParams(router.state.location.search).get("filter")).toBe("tag:work");
+ expect(screen.getByRole("dialog")).toBeInTheDocument();
+ expect(screen.getByRole("link", { name: "common.explore" })).toHaveAttribute("aria-current", "page");
});
- it("keeps long titles on a truncated rail and exposes the complete value", async () => {
- const longTitle = "A very long product research and planning space title";
- spaceState.spaces = [{ name: "spaces/product", title: longTitle, description: "" }];
- spaceState.selectedSpaceName = spaceState.spaces[0].name;
- spaceState.selectedSpace = spaceState.spaces[0];
- render(<SpaceSwitcher />);
-
- const trigger = screen.getByRole("button", { name: `space.switch: ${longTitle}` });
- expect(trigger).toHaveAttribute("title", longTitle);
- expect(within(trigger).getByText(longTitle)).toHaveClass("truncate");
- fireEvent.click(trigger);
-
- const row = await screen.findByRole("menuitemradio", { name: longTitle });
- expect(row).toHaveAttribute("title", longTitle);
- expect(within(row).getByText(longTitle)).toHaveClass("max-w-full", "truncate");
+ it("opens Space choices on demand and preserves creator when choosing one", async () => {
+ const router = renderAt("/?creator=alice");
+ openSwitcher();
+ expect(screen.queryByRole("button", { name: "space.create" })).not.toBeInTheDocument();
+ expect(screen.queryByText("Product")).not.toBeInTheDocument();
+ fireEvent.click(screen.getByRole("combobox", { name: "space.switch" }));
+ const product = await screen.findByRole("option", { name: "Product" });
+ fireEvent.pointerDown(product, { pointerType: "mouse" });
+ fireEvent.click(product, { pointerType: "mouse" });
+ await waitFor(() => expect(router.state.location.pathname).toBe("/spaces/product"));
+ expect(new URLSearchParams(router.state.location.search).get("creator")).toBe("alice");
+ expect(screen.getByRole("dialog")).toBeInTheDocument();
+ expect(state.setMobileOpen).not.toHaveBeenCalled();
});
- it("uses the compact lockup in header chrome", () => {
- spaceState.selectedSpaceName = "spaces/product";
- spaceState.selectedSpace = spaceState.spaces[0];
- render(<SpaceSwitcher size="header" />);
-
- const trigger = screen.getByRole("button", { name: "space.switch: Product" });
- const title = within(trigger).getByText("Product");
- const mark = trigger.querySelector(".lucide-astroid")?.parentElement;
-
+ it("uses the selected author in the user slot and trigger", () => {
+ state.selectedSpaceName = "spaces/product";
+ state.selectedSpace = state.spaces[0];
+ renderAt("/spaces/product?creator=alice", "header");
+ const trigger = screen.getByRole("button", { name: "space.switch: Alice / Product" });
+ expect(within(trigger).getByText("Alice / Product")).toHaveClass("truncate");
expect(trigger).toHaveClass("h-9", "gap-2", "px-2");
- expect(trigger).not.toHaveClass("px-1");
- expect(title).toHaveClass("text-[15px]", "font-semibold", "leading-5");
- expect(mark).toHaveClass("size-6", "rounded-[6px]");
- expect(mark?.querySelector(".lucide-astroid")).toHaveClass("size-3.5");
- expect(trigger.querySelector(".lucide-chevrons-up-down")).toHaveClass("size-3");
- expect(trigger.querySelector(".lucide-chevron-down")).toBeNull();
+ openSwitcher();
+ expect(screen.queryByRole("navigation", { name: "common.browse" })).not.toBeInTheDocument();
+ expect(screen.getByRole("link", { name: "Back to common.home" })).toHaveAttribute("href", "/spaces/product");
});
- it("keeps duplicate identity in the header label but out of its geometry", () => {
- spaceState.spaces = [
- { name: "spaces/product-notes", title: "Product", description: "" },
- { name: "spaces/product-archive", title: "Product", description: "" },
- ];
- spaceState.selectedSpaceName = spaceState.spaces[0].name;
- spaceState.selectedSpace = spaceState.spaces[0];
- render(<SpaceSwitcher size="header" />);
-
- const trigger = screen.getByRole("button", { name: "space.switch: Product (product-notes)" });
- expect(trigger).toHaveAttribute("title", "Product (product-notes)");
- expect(trigger).toHaveClass("h-9", "px-2");
- expect(within(trigger).queryByTitle("product-notes")).not.toBeInTheDocument();
+ it("returns from another creator to the selected Space Home without closing the menu", () => {
+ state.selectedSpaceName = "spaces/product";
+ state.selectedSpace = state.spaces[0];
+ const router = renderAt("/spaces/product/map?creator=alice");
+ openSwitcher();
+ fireEvent.click(screen.getByRole("link", { name: "Back to common.home" }));
+ expect(router.state.location.pathname).toBe("/spaces/product");
+ expect(router.state.location.search).toBe("");
+ expect(screen.getByRole("dialog")).toBeInTheDocument();
+ expect(screen.getByRole("link", { name: "common.home" })).toHaveAttribute("aria-current", "page");
+ expect(screen.getByRole("button", { name: "space.create" })).toBeInTheDocument();
+ expect(state.setMobileOpen).not.toHaveBeenCalled();
});
- it("shows UIDs only for Spaces whose titles match", async () => {
- const uuid = "123e4567-e89b-12d3-a456-426614174000";
- spaceState.spaces = [
- { name: "spaces/product-notes", title: "Product", description: "" },
- { name: `spaces/${uuid}`, title: "Product", description: "" },
- { name: "spaces/research-space", title: "Research", description: "" },
- ];
- spaceState.selectedSpaceName = spaceState.spaces[0].name;
- spaceState.selectedSpace = spaceState.spaces[0];
- render(<SpaceSwitcher />);
-
- const trigger = screen.getByRole("button", { name: "space.switch: Product (product-notes)" });
- expect(within(trigger).getByTitle("product-notes")).toHaveTextContent("product-notes");
- fireEvent.click(trigger);
-
- const customIdRow = await screen.findByRole("menuitemradio", { name: "Product (product-notes)" });
- const uuidRow = screen.getByRole("menuitemradio", { name: `Product (${uuid})` });
- expect(within(customIdRow).getByTitle("product-notes")).toHaveTextContent("product-notes");
- expect(within(uuidRow).getByTitle(uuid)).toHaveTextContent("123e4567…");
- const researchRow = screen.getByRole("menuitemradio", { name: "Research" });
- expect(within(researchRow).queryByTitle("research-space")).not.toBeInTheDocument();
- expect(researchRow).not.toHaveTextContent("research-space");
+ it("treats an explicit current creator as Home", () => {
+ renderAt("/calendar/2026/09?creator=steven");
+ openSwitcher();
+ expect(screen.getByRole("link", { name: "common.home" })).toHaveAttribute("aria-current", "page");
+ expect(screen.queryByRole("link", { name: /Back to/ })).not.toBeInTheDocument();
+ expect(screen.getByRole("button", { name: "space.create" })).toBeInTheDocument();
});
- it("links to spaces and opens Space creation", async () => {
- render(<SpaceSwitcher />);
- fireEvent.click(screen.getByRole("button", { name: "space.switch: common.memos" }));
- const product = await screen.findByRole("menuitemradio", { name: "Product" });
- expect(product).toHaveAttribute("href", "/spaces/product");
- fireEvent.click(product);
-
- await waitFor(() => expect(screen.queryByRole("menu")).not.toBeInTheDocument());
-
- // Selecting Memos is how a signed-in user gets back to the home feed.
- fireEvent.click(screen.getByRole("button", { name: "space.switch: common.memos" }));
- fireEvent.click(await screen.findByRole("menuitemradio", { name: "Memos" }));
+ it("returns guests from a creator to Explore without showing private actions", () => {
+ state.currentUser = undefined;
+ const router = renderAt("/?creator=alice");
+ openSwitcher();
+ expect(screen.getByRole("link", { name: "Back to common.explore" })).toHaveAttribute("href", "/explore");
+ expect(screen.queryByRole("combobox")).not.toBeInTheDocument();
+ expect(screen.queryByRole("button", { name: "space.create" })).not.toBeInTheDocument();
+ expect(screen.queryByRole("button", { name: "Steven account" })).not.toBeInTheDocument();
+ expect(screen.getByRole("button", { name: "common.sign-in" })).toBeInTheDocument();
+ fireEvent.click(screen.getByRole("link", { name: "Back to common.explore" }));
+ expect(router.state.location.pathname).toBe("/explore");
+ expect(router.state.location.search).toBe("");
+ expect(screen.getByRole("dialog")).toBeInTheDocument();
+ expect(screen.queryByRole("link", { name: "common.home" })).not.toBeInTheDocument();
+ expect(screen.getByRole("link", { name: "common.explore" })).toHaveAttribute("aria-current", "page");
+ });
- await waitFor(() => expect(screen.queryByRole("menu")).not.toBeInTheDocument());
- fireEvent.click(screen.getByRole("button", { name: "space.switch: common.memos" }));
- fireEvent.click(await screen.findByRole("menuitem", { name: "space.create" }));
- expect(screen.getByRole("dialog", { name: "" })).toHaveTextContent("Create Space dialog");
+ it("keeps the popup aligned to the sidebar rail and opens Space creation", () => {
+ renderAt();
+ const trigger = screen.getByRole("button", { name: /space.switch:/ });
+ const sidebar = trigger.closest("aside") as HTMLElement;
+ vi.spyOn(sidebar, "getBoundingClientRect").mockReturnValue({ left: 0, right: 223, width: 223 } as DOMRect);
+ vi.spyOn(trigger, "getBoundingClientRect").mockReturnValue({ left: 12, right: 143, width: 131 } as DOMRect);
+ openSwitcher();
+ expect(document.querySelector('[data-slot="popover-content"]')).toHaveStyle({ width: "199px" });
+ fireEvent.click(screen.getByRole("button", { name: "space.create" }));
fireEvent.click(screen.getByRole("button", { name: "Complete create" }));
- expect(spaceState.selectSpace).toHaveBeenCalledWith(spaceState.spaces[0]);
+ expect(state.selectSpace).toHaveBeenCalledWith(state.spaces[0]);
});
});
diff --git a/web/tests/timeline-view-scope.test.tsx b/web/tests/timeline-view-scope.test.tsx
new file mode 100644
index 000000000..3c8b4d5b2
--- /dev/null
+++ b/web/tests/timeline-view-scope.test.tsx
@@ -0,0 +1,76 @@
+import { act, render, screen } from "@testing-library/react";
+import { createMemoryRouter, RouterProvider } from "react-router-dom";
+import { beforeEach, describe, expect, it } from "vitest";
+import { TimelineViewProvider, useLinkPreviewEnabled, useView } from "@/contexts/ViewContext";
+
+const storageKey = "memos-view-setting";
+const saved = { timeBasis: "update_time", orderByTimeAsc: true, maxColumns: 3, compactMode: true, linkPreview: false };
+const defaults = { timeBasis: "create_time", orderByTimeAsc: false, maxColumns: 1, compactMode: false, linkPreview: true };
+
+function Probe() {
+ const { timeBasis, orderByTimeAsc, maxColumns, compactMode } = useView();
+ const linkPreview = useLinkPreviewEnabled();
+ return <output>{JSON.stringify({ timeBasis, orderByTimeAsc, maxColumns, compactMode, linkPreview })}</output>;
+}
+
+function renderRoute(path: string) {
+ const router = createMemoryRouter(
+ [
+ {
+ path: "*",
+ element: (
+ <TimelineViewProvider>
+ <Probe />
+ </TimelineViewProvider>
+ ),
+ },
+ ],
+ { initialEntries: [path] },
+ );
+ render(<RouterProvider router={router} />);
+ return router;
+}
+
+const settings = () => JSON.parse(screen.getByRole("status").textContent ?? "{}");
+
+describe("Timeline display settings scope", () => {
+ beforeEach(() => localStorage.setItem(storageKey, JSON.stringify(saved)));
+
+ it.each([
+ "/",
+ "/explore",
+ "/?creator=alice",
+ "/spaces/test",
+ "/spaces/test/explore",
+ "/Spaces/test/Explore/",
+ ])("applies saved preferences to %s", (path) => {
+ renderRoute(path);
+ expect(settings()).toEqual(saved);
+ });
+
+ it.each([
+ "/calendar",
+ "/map",
+ "/archived",
+ "/attachments",
+ "/memos/example",
+ "/memos/shares/example",
+ "/spaces/test/calendar",
+ "/spaces/test/map",
+ "/setting",
+ "/views",
+ ])("keeps %s independent of Timeline preferences", (path) => {
+ renderRoute(path);
+ expect(settings()).toEqual(defaults);
+ });
+
+ it("restores Timeline preferences after visiting another view without overwriting storage", async () => {
+ const router = renderRoute("/spaces/test?creator=alice");
+ expect(settings()).toEqual(saved);
+ await act(() => router.navigate("/spaces/test/calendar?creator=alice"));
+ expect(settings()).toEqual(defaults);
+ await act(() => router.navigate("/spaces/test?creator=alice"));
+ expect(settings()).toEqual(saved);
+ expect(JSON.parse(localStorage.getItem(storageKey) ?? "{}")).toEqual(saved);
+ });
+});
diff --git a/web/tests/user-avatar.test.tsx b/web/tests/user-avatar.test.tsx
new file mode 100644
index 000000000..d811f6577
--- /dev/null
+++ b/web/tests/user-avatar.test.tsx
@@ -0,0 +1,30 @@
+import { render } from "@testing-library/react";
+import { describe, expect, it } from "vitest";
+import UserAvatar from "@/components/UserAvatar";
+
+describe("UserAvatar", () => {
+ it("uses the display title for a stable solid color", () => {
+ const { container, rerender } = render(<UserAvatar name="Steven" />);
+ const avatar = container.firstElementChild as HTMLElement;
+ expect(avatar.style.getPropertyValue("--avatar-hue")).toMatch(/^\d+deg$/);
+ expect(avatar.children).toHaveLength(0);
+ const hue = avatar.style.getPropertyValue("--avatar-hue");
+
+ rerender(<UserAvatar name="steven" />);
+ expect(avatar.style.getPropertyValue("--avatar-hue")).toBe(hue);
+ rerender(<UserAvatar name="Alice" />);
+ expect(avatar.style.getPropertyValue("--avatar-hue")).not.toBe(hue);
+ expect(avatar.children).toHaveLength(0);
+ });
+
+ it("keeps a supplied image and uses a neutral fallback without a title", () => {
+ const { container, rerender } = render(<UserAvatar avatarUrl="/avatar.png" name="Steven" />);
+ expect(container.querySelector("img")).toHaveAttribute("src", "/avatar.png");
+ expect(container.firstElementChild).not.toHaveAttribute("style");
+
+ rerender(<UserAvatar />);
+ expect(container.querySelector("img")).toBeNull();
+ expect(container.firstElementChild?.children).toHaveLength(0);
+ expect(container.firstElementChild).toHaveClass("bg-muted");
+ });
+});
diff --git a/web/tests/user-menu.test.tsx b/web/tests/user-menu.test.tsx
index 04195aad1..c406c0d1c 100644
--- a/web/tests/user-menu.test.tsx
+++ b/web/tests/user-menu.test.tsx
@@ -1,125 +1,133 @@
-import { fireEvent, render, screen } from "@testing-library/react";
+import { fireEvent, render, screen, within } from "@testing-library/react";
import { MemoryRouter } from "react-router-dom";
import { beforeEach, describe, expect, it, vi } from "vitest";
-import UserMenu from "@/components/UserMenu";
+import UserMenu, { UserPreferenceDialog } from "@/components/UserMenu";
+import { loadLocale } from "@/utils/i18n";
+import { loadTheme } from "@/utils/theme";
const mocks = vi.hoisted(() => ({
navigateTo: vi.fn(),
setMobileOpen: vi.fn(),
+ onSelectPreference: vi.fn(),
+ onClose: vi.fn(),
logout: vi.fn(),
+ updateGeneralSetting: vi.fn(),
+ refetchSettings: vi.fn(),
notifications: [] as Array<{ status: number }>,
}));
-vi.mock("@/contexts/AppSidebarContext", () => ({
- useAppSidebar: () => ({ setMobileOpen: mocks.setMobileOpen }),
-}));
-
+vi.mock("@/contexts/AppSidebarContext", () => ({ useAppSidebar: () => ({ setMobileOpen: mocks.setMobileOpen }) }));
vi.mock("@/contexts/AuthContext", () => ({
- useAuth: () => ({
- userGeneralSetting: undefined,
- refetchSettings: vi.fn(),
- logout: mocks.logout,
- }),
+ useAuth: () => ({ userGeneralSetting: undefined, refetchSettings: mocks.refetchSettings, logout: mocks.logout }),
}));
-
+vi.mock("@/hooks/useLiveMemoRefresh", () => ({ useSSEConnectionStatus: () => "connected" }));
vi.mock("@/hooks/useCurrentUser", () => ({
default: () => ({ name: "users/steven", username: "steven", displayName: "Steven" }),
}));
-
-vi.mock("@/hooks/useLiveMemoRefresh", () => ({
- useSSEConnectionStatus: () => "connected",
-}));
-
-vi.mock("@/hooks/useNavigateTo", () => ({
- default: () => mocks.navigateTo,
-}));
-
+vi.mock("@/hooks/useNavigateTo", () => ({ default: () => mocks.navigateTo }));
vi.mock("@/hooks/useUserQueries", () => ({
useNotifications: () => ({ data: mocks.notifications }),
- useUpdateUserGeneralSetting: () => ({ mutate: vi.fn() }),
+ useUpdateUserGeneralSetting: () => ({ mutate: mocks.updateGeneralSetting }),
+}));
+vi.mock("@/components/LocalePicker", () => ({
+ LocaleSearchList: ({ onChange }: { onChange: (locale: string) => void }) => (
+ <button type="button" onClick={() => onChange("fr")}>
+ Choose French
+ </button>
+ ),
+}));
+vi.mock("@/utils/i18n", async (importOriginal) => ({
+ ...(await importOriginal<typeof import("@/utils/i18n")>()),
+ getLocaleWithFallback: () => "en",
+ loadLocale: vi.fn(),
+ useTranslate: () => (key: string) => key,
+}));
+vi.mock("@/utils/theme", async (importOriginal) => ({
+ ...(await importOriginal<typeof import("@/utils/theme")>()),
+ getThemeWithFallback: () => "system",
+ loadTheme: vi.fn(),
}));
-vi.mock("@/utils/i18n", async (importOriginal) => {
- const actual = await importOriginal<typeof import("@/utils/i18n")>();
- return {
- ...actual,
- getLocaleWithFallback: () => "en",
- loadLocale: vi.fn(),
- useTranslate: () => (key: string) => key,
- };
-});
+const renderMenu = (path = "/") =>
+ render(
+ <MemoryRouter initialEntries={[path]}>
+ <UserMenu onSelectPreference={mocks.onSelectPreference} onClose={mocks.onClose} />
+ </MemoryRouter>,
+ );
-describe("User menu", () => {
+describe("User menu panel", () => {
beforeEach(() => {
mocks.navigateTo.mockReset();
mocks.setMobileOpen.mockReset();
+ mocks.onSelectPreference.mockReset();
+ mocks.onClose.mockReset();
mocks.logout.mockReset();
+ mocks.updateGeneralSetting.mockReset();
+ mocks.refetchSettings.mockReset();
mocks.notifications = [];
});
- it("groups Inbox and Archived with Profile and marks Archived active", async () => {
- render(
- <MemoryRouter initialEntries={["/archived"]}>
- <UserMenu />
- </MemoryRouter>,
- );
-
- fireEvent.click(screen.getByRole("button", { name: /Steven/ }));
-
- const profile = await screen.findByRole("menuitem", { name: "common.profile" });
- const inbox = screen.getByRole("menuitem", { name: "common.inbox" });
- const archived = screen.getByRole("menuitem", { name: "common.archived" });
- expect(profile.compareDocumentPosition(inbox) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
+ it("places Inbox beside the account and Archived directly above Settings", () => {
+ renderMenu("/archived");
+ const accountHeader = screen.getByText("Steven").parentElement!;
+ const inbox = within(accountHeader).getByRole("button", { name: "common.inbox" });
+ const archived = screen.getByRole("button", { name: "common.archived" });
+ expect(screen.queryByText("setting.sso.account")).not.toBeInTheDocument();
+ expect(inbox).toHaveClass("h-5", "text-[10px]");
expect(inbox.compareDocumentPosition(archived) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
- expect(archived).toHaveAttribute("aria-current", "page");
- expect(screen.getAllByRole("separator")).toHaveLength(2);
-
+ expect(archived.nextElementSibling).toBe(screen.getByRole("button", { name: "common.settings" }));
+ expect(archived).toHaveClass("bg-accent");
fireEvent.click(archived);
+ expect(mocks.onClose).toHaveBeenCalledOnce();
expect(mocks.setMobileOpen).toHaveBeenCalledWith(false);
expect(mocks.navigateTo).toHaveBeenCalledWith("/archived");
});
- it("uses a full-bleed footer trigger, inset menu width, and preserves the Inbox unread state", async () => {
+ it("shows unread Inbox count and navigates from the same panel", () => {
mocks.notifications = [{ status: 1 }, { status: 1 }, { status: 2 }];
- render(
- <MemoryRouter initialEntries={["/Inbox/"]}>
- <UserMenu />
- </MemoryRouter>,
- );
-
- const trigger = screen.getByRole("button", { name: "Steven, common.more, 2 inbox.unread" });
- expect(trigger).toHaveClass("h-9", "w-full", "gap-1", "px-5");
- expect(trigger).not.toHaveClass("rounded-md");
- expect(trigger.firstElementChild).toHaveClass("size-5");
- expect(trigger.querySelector(".lucide-ellipsis-vertical")).not.toBeNull();
- expect(trigger.querySelector(".lucide-chevrons-up-down")).toBeNull();
- expect(trigger.querySelector("[data-inbox-unread-indicator]")).not.toBeNull();
- fireEvent.click(trigger);
-
- const inbox = await screen.findByRole("menuitem", { name: "common.inbox, 2 inbox.unread" });
- const menu = screen.getByRole("menu");
- expect(menu).toHaveClass("w-[calc(var(--anchor-width)-1.5rem)]");
- expect(menu).not.toHaveClass("min-w-56");
- expect(inbox).toHaveAttribute("aria-current", "page");
- expect(inbox).toHaveTextContent("common.inbox");
+ renderMenu("/Inbox/");
+ const inbox = screen.getByRole("button", { name: "common.inbox, 2 inbox.unread" });
+ expect(inbox).toHaveClass("bg-accent");
expect(inbox).toHaveTextContent("2");
-
fireEvent.click(inbox);
- expect(mocks.setMobileOpen).toHaveBeenCalledWith(false);
expect(mocks.navigateTo).toHaveBeenCalledWith("/inbox");
});
- it("keeps the collapsed trigger on the artwork rail", () => {
+ it("shows current preferences as direct rows", () => {
+ renderMenu();
+ fireEvent.click(screen.getByRole("button", { name: /setting.preference.theme.*Sync with system/ }));
+ fireEvent.click(screen.getByRole("button", { name: /common.language.*English/ }));
+ expect(mocks.onSelectPreference.mock.calls).toEqual([["theme"], ["language"]]);
+ expect(screen.getByRole("button", { name: "common.settings" })).toBeInTheDocument();
+ });
+
+ it("applies a theme from a separate dialog", () => {
render(
- <MemoryRouter initialEntries={["/"]}>
- <UserMenu collapsed />
+ <MemoryRouter>
+ <UserPreferenceDialog preference="theme" onClose={mocks.onClose} />
</MemoryRouter>,
);
+ fireEvent.click(screen.getByRole("button", { name: "Dark" }));
+ expect(loadTheme).toHaveBeenCalledWith("default-dark");
+ expect(mocks.updateGeneralSetting).toHaveBeenCalledWith(
+ { generalSetting: { theme: "default-dark" }, updateMask: ["theme"] },
+ expect.objectContaining({ onSuccess: expect.any(Function) }),
+ );
+ expect(mocks.onClose).toHaveBeenCalledOnce();
+ });
- const trigger = screen.getByRole("button", { name: /Steven/ });
- expect(trigger).toHaveClass("ms-3", "size-9", "rounded-md", "p-2");
- expect(trigger).not.toHaveClass("w-full");
- expect(trigger).not.toHaveClass("px-5");
- expect(trigger).not.toHaveClass("rounded-none");
+ it("applies a locale from a separate dialog", () => {
+ render(
+ <MemoryRouter>
+ <UserPreferenceDialog preference="language" onClose={mocks.onClose} />
+ </MemoryRouter>,
+ );
+ fireEvent.click(screen.getByRole("button", { name: "Choose French" }));
+ expect(loadLocale).toHaveBeenCalledWith("fr");
+ expect(mocks.updateGeneralSetting).toHaveBeenCalledWith(
+ { generalSetting: { locale: "fr" }, updateMask: ["locale"] },
+ expect.objectContaining({ onSuccess: expect.any(Function) }),
+ );
+ expect(mocks.onClose).toHaveBeenCalledOnce();
});
});