Enhance API and frontend components for character management and map visibility
- Updated API documentation to include `ownedByMe` field in character responses, indicating if a character was last updated by the current user's tokens. - Modified MapView component to track and display the live status based on user-owned characters. - Enhanced map data handling to exclude hidden maps for non-admin users and improved character icon representation on the map. - Refactored character data structures to support new properties and ensure accurate rendering in the frontend.
This commit is contained in:
@@ -374,6 +374,8 @@ func (s *ClientService) UpdatePositions(ctx context.Context, data []byte) error
|
||||
return nil
|
||||
})
|
||||
|
||||
username, _ := ctx.Value(app.ClientUsernameKey).(string)
|
||||
|
||||
s.withChars(func(chars map[string]app.Character) {
|
||||
for id, craw := range craws {
|
||||
gd, ok := gridDataByID[craw.GridID]
|
||||
@@ -389,8 +391,9 @@ func (s *ClientService) UpdatePositions(ctx context.Context, data []byte) error
|
||||
X: craw.Coords.X + (gd.Coord.X * app.GridSize),
|
||||
Y: craw.Coords.Y + (gd.Coord.Y * app.GridSize),
|
||||
},
|
||||
Type: craw.Type,
|
||||
Updated: time.Now(),
|
||||
Type: craw.Type,
|
||||
Updated: time.Now(),
|
||||
Username: username,
|
||||
}
|
||||
old, ok := chars[id]
|
||||
if !ok {
|
||||
@@ -401,6 +404,7 @@ func (s *ClientService) UpdatePositions(ctx context.Context, data []byte) error
|
||||
chars[id] = c
|
||||
} else {
|
||||
old.Position = c.Position
|
||||
old.Username = username
|
||||
chars[id] = old
|
||||
}
|
||||
} else if old.Type != "unknown" {
|
||||
@@ -408,6 +412,7 @@ func (s *ClientService) UpdatePositions(ctx context.Context, data []byte) error
|
||||
chars[id] = c
|
||||
} else {
|
||||
old.Position = c.Position
|
||||
old.Username = username
|
||||
chars[id] = old
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user