mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Lots of updates
This commit is contained in:
9
src/utils/getCurrentTab.ts
Normal file
9
src/utils/getCurrentTab.ts
Normal file
@ -0,0 +1,9 @@
|
||||
const getCurrentTab = (navigation: any) => {
|
||||
const {
|
||||
length,
|
||||
[length - 1]: last
|
||||
} = navigation.dangerouslyGetState().history
|
||||
return `Screen-${last.key.split(new RegExp(/Screen-(.*?)-/))[1]}`
|
||||
}
|
||||
|
||||
export default getCurrentTab
|
@ -17,15 +17,34 @@ export type InstancesState = {
|
||||
}
|
||||
}
|
||||
|
||||
const initialStateLocal = {
|
||||
url: undefined,
|
||||
token: undefined,
|
||||
account: {
|
||||
id: undefined,
|
||||
preferences: {
|
||||
'posting:default:visibility': undefined,
|
||||
'posting:default:sensitive': undefined,
|
||||
'posting:default:language': undefined,
|
||||
'reading:expand:media': undefined,
|
||||
'reading:expand:spoilers': undefined
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const updateLocal = createAsyncThunk(
|
||||
'instances/updateLocal',
|
||||
async ({
|
||||
url,
|
||||
token
|
||||
}: {
|
||||
url: InstancesState['local']['url']
|
||||
token: InstancesState['local']['token']
|
||||
url?: InstancesState['local']['url']
|
||||
token?: InstancesState['local']['token']
|
||||
}) => {
|
||||
if (!url || !token) {
|
||||
return initialStateLocal
|
||||
}
|
||||
|
||||
const {
|
||||
body: { id }
|
||||
} = await client({
|
||||
@ -58,22 +77,9 @@ export const updateLocal = createAsyncThunk(
|
||||
const instancesSlice = createSlice({
|
||||
name: 'instances',
|
||||
initialState: {
|
||||
local: {
|
||||
url: undefined,
|
||||
token: undefined,
|
||||
account: {
|
||||
id: undefined,
|
||||
preferences: {
|
||||
'posting:default:visibility': undefined,
|
||||
'posting:default:sensitive': undefined,
|
||||
'posting:default:language': undefined,
|
||||
'reading:expand:media': undefined,
|
||||
'reading:expand:spoilers': undefined
|
||||
}
|
||||
}
|
||||
},
|
||||
local: initialStateLocal,
|
||||
remote: {
|
||||
url: 'mastodon.social'
|
||||
url: 'm.cmx.im'
|
||||
}
|
||||
} as InstancesState,
|
||||
reducers: {},
|
||||
@ -85,6 +91,7 @@ const instancesSlice = createSlice({
|
||||
})
|
||||
|
||||
export const getLocalUrl = (state: RootState) => state.instances.local.url
|
||||
export const getRemoteUrl = (state: RootState) => state.instances.remote.url
|
||||
export const getLocalAccountId = (state: RootState) =>
|
||||
state.instances.local.account.id
|
||||
export const getLocalAccountPreferences = (state: RootState) =>
|
||||
|
@ -3,6 +3,8 @@ export default {
|
||||
FONT_SIZE_M: 14,
|
||||
FONT_SIZE_L: 18,
|
||||
|
||||
FONT_WEIGHT_BOLD: '600',
|
||||
|
||||
SPACING_XS: 4,
|
||||
SPACING_S: 8,
|
||||
SPACING_M: 16,
|
||||
|
@ -7,6 +7,7 @@ export type ColorDefinitions =
|
||||
| 'link'
|
||||
| 'border'
|
||||
| 'separator'
|
||||
| 'dangerous'
|
||||
|
||||
const themeColors: {
|
||||
[key in ColorDefinitions]: {
|
||||
@ -37,6 +38,10 @@ const themeColors: {
|
||||
separator: {
|
||||
light: 'rgba(0, 0, 0, 0.1)',
|
||||
dark: 'rgba(255, 255, 255, 0.1)'
|
||||
},
|
||||
dangerous: {
|
||||
light: 'rgb(255, 59, 48)',
|
||||
dark: 'rgb(255, 69, 58)'
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user